R(Q)= R(Q)=
Nous admettrons sans le démontrer que R(Q) est une
fonction croissante, puis décroissante de Q.
A cette effet, l'optimum sera atteint lorsque :
R (Q+1)-R(Q) devient négatif.
R (Q+1)-R(Q) = (Cp+Cs)(Q+1)P(Q+1) - (Cp+Cs) QP(Q+1) - (Cp+Cs)
F(Q+1)+Cp
= (Cp+Cs)(Q+1)P(Q+1) - (Cp+Cs) F(Q+1)+Cp
Puisque
F (Q+1) = F(Q) + p (Q+1)
R (Q+1) - R(Q) = Cp- (Cp+Cs) F (Q).
Donc la valeur optimal est la plus petite valeur de Q telle
que :
Cp- (Cp+Cs) F (Q) < 0 donc telle que
F(Q)>
Le coût de stockage par article et par mois
s'élève à 200 Fc, le manque à gagner est
estimé à 400 Fc par produit non disponible.
Pour résoudre ce problème, il faut envisager
pour touts les cas possibles le coût de gestion du constitué
par :
Le coût de stockage K2 qui dépend de la
valeur de X :
Si X <= Q : K2 = (Q - ) Cs
Si X > Q : K2 = ( ) Cs
Le coût de pénurie K3 = (X
-Q)Cp
X
Prob
Q
|
280
0,1
|
380
0,2
|
480
0,3
|
580
0,2
|
680
0,1
|
780
0,1
|
COUT DE GESTION
|
280
|
K2=28000
|
K2=20631,6
K3=40000
|
K2=16333,33
K3=80000
|
K2=13517,24
K3=12000
|
K2=11529,41
K3 =16000
|
K2=10051,3
K3=20000
|
89087,83
|
380
|
K2=48000
|
K2=38000
|
K2=30083,33
K3=40000
|
K2=24896,6
K3=80000
|
K2=21235,3
K3=120000
|
K2=18512,82
K3=160000
|
86379,13
|
480
|
K2=68000
|
K2=58000
|
K2=48000
|
K2=39724,14
K3=40000
|
K2=33882,35
K3= 80000
|
K2=29538,5
K3=120000
|
75086,91
|
580
|
K2=88000
|
K2=78000
|
K2=68000
|
K2=58000
|
K2=49470,6
K3=40000
|
K2=43128,20
K3=80000
|
77659,88
|
680
|
K2=108000
|
K2=98000
|
K2=88000
|
K2=78000
|
K2=68000
|
K2=59282,05
K3=40000
|
89128,21
|
780
|
K2=128000
|
K2=118000
|
108000
|
98000
|
88000
|
78000
|
105000
|
Le choix sera un niveau de stock de début de
période 480 car le coût de gestion moyen est
minimum.
- La consommation mensuelle de l'eau pure HOREB est de 2304
- La consommation journalière est de 96
bidons/année de 300 Jours
- Le délai de réapprovisionnement est de 5
jours
- Le point de commande est de 480 bidons
- La quantité économique à
commandée est de 768 bidons soit 3 commande par mois
- Soit une consommation tous les 5 jours
- Le coût unitaire de détention est de 200
Fc/bidon et par mois
- Le coût de rupture est de 400 Fc /bidon
Pour dégager le niveau de consommation et de rupture
de stock nous allons nous référer au tableau ci-dessous pour
faire sortir le niveau de possibilité de stock en fonction du niveau
possible de consommation.
Niveau de consommation pendant le délai
d'approvisionnement
|
niveau de possibilité de stock en fonction du niveau
possible de consommation
|
BIDONS (demande)
|
PROBABILITE
|
BIDONS (manquants)
|
280
|
0,1
|
0
|
380
|
0,2
|
0
|
480
|
0,3
|
0
|
580
|
0,2
|
100
|
680
|
0,1
|
200
|
780
|
0,1
|
300
|
Nous avons trouvés les résultats de la
troisième colonne avec la formule suivante :
· Considérons tout d'abord notre point de commande
qui est de 480 bidons ce qui est en d'autres termes notre stock de
sécurité. si les nombres des bidons utilisés sont
inférieurs ou égale au stock de sécurité, le
niveau de possibilité de stock en fonction du niveau possible de
consommation est égal à zéro car il n'y a pas des pertes.
Mais si les nombres des bidons utilisés sont supérieurs au stock
de sécurité, nous allons prendre les nombres des bidons du niveau
de consommation pendant le délai d'approvisionnement en faisant une
soustraction avec le stock de sécurité.
Après avoir ressortis tout ces problèmes, nous
allons maintenant passer au tableau qui va nous permettre de trouver
l'espérance Mathématique de coût de rupture.
Niveau de stock de sécurité
|
Niveau de consommation
|
Nombre des bidons manquants
|
Coût unitaire de rupture
|
Probabilité
|
Nombre des commandes
|
Expérience Mathématique de coût
total de rupture
|
0
|
280
380
480
580
680
780
|
0
0
0
100
200
300
|
400
|
0,1
0,2
0,3
0,2
0,1
0,1
|
3
|
0
0
0
24000
24000
36000
|
100
|
280
380
480
580
680
780
|
0
0
0
0
100
200
|
0,1
0,2
0,3
0,2
0,1
0,1
|
0
0
0
0
12000
24000
|
200
|
280
380
480
580
680
780
|
0
0
0
0
0
100
|
0,1
0,2
0,3
0,2
0,1
0,1
|
0
0
0
0
0
12000
|
300
|
280
380
480
580
680
780
|
0
0
0
0
0
0
|
0,1
0,2
0,3
0,2
0,1
0,1
|
0
0
0
0
0
0
|
ESPERIENCE MATHEMATIQUE DE COUT DE
RUPTURE
L'expérience Mathématique est trouvée
à l'aide de la formule ci-après :
(Nombres des bidons manquants) x
(Coût unitaire de rupture) x
(Probabilité) x (Nombre des
commandes)
Exemple : considérons notre niveau de stock de
sécurité 0
.
Nous avons au niveau de consommation (les quantités)
suivantes : 280, 380, 480, 580, 680 et 780. Pour se faire, nous allons
prendre dans ce niveau en premier lieu la quantité 280,
ce la va nous produire ;
0 x 400 x 0,1
x 3 =0
0 x 400 x 0,2
x 3 =0
0 x 400 x 0,3
x 3 =0
100 x 400 x 0,2
x 3 =24000
200 x 400 x 0,1
x 3 =24000
300 x 400 x 0,1
x 3 =36000
En ce qui suit, nous présentons le niveau du stock de
sécurité en fonction de la variabilité de la consommation
de la demande.
NIVEAU OPTIMAL DU STOCK DE SECURITE EN FONCTION DE LA
VARIABILITE DE LA CONSOMMATION DE LA DEMANDE
Niveau de stock de sécurité
|
Coût de détention
|
Espérance Mathématique
|
Fonction du coût global
|
0
100
200
300
|
0
20.000
40.000
60.000
|
84000
36000
12.000
0
|
84.000
56.000
52.000
60.000
|
Dans ce tableau, le Coût de détention
est trouvé d'après la multiplication du Niveau
de stock de sécurité avec les Nombre des
commandes, et l'espérance
Mathématique trouvé en fonction de la du niveau de stock de sécurité du
tableau expliqué ci-dessus et en fin Fonction du coût
global est juste l'addition du cout de détention
avec l'espérance Mathématique (du
deuxième tableau).
Pour clore, nous témoignons que le niveau de stock de
sécurité de 200 est celui que nous maintenons
car sa fonction du coût global est minimum.
Quant à la formule de la valeur optimal :
F(Q)>
Nous obtenons : = 0,667
251668992
using System;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace MINDONGO_FACTURATION_DEVIS
{
public class Compte_Utilisateur :
System.Windows.Forms.Form
{
private System.Windows.Forms.Button conexion;
private System.Windows.Forms.Label login;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox mot_de_passe;
private System.Windows.Forms.TextBox compte;
/// <summary>
/// Required designer variable.
/// </summary>
///
private System.ComponentModel.IContainer components =
null;
public Compte_Utilisateur()
{
//
// Requis pour la prise en charge du Concepteur
Windows Forms
//
InitializeComponent();
//
// TODO : ajoutez le code du constructeur
après l'appel à InitializeComponent
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed
resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void conexion_Click(object
sender,System.EventArgs e)
{
cnx();
}
void cnx()
{
if
(this.MdiParent.Menu.MenuItems[0].MenuItems[0].Text =="SeConnecter")
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
try
{
cnx.Open();
}
catch
{
MessageBox.Show("Erreure de la
Connexion");
}
finally
{
OdbcCommand commd;
commd = new OdbcCommand("select * from utilisateur where login=?
and mot_de_passe=?", cnx);
commd.Parameters.Add("login",
compte.Text);
commd.Parameters.Add("mot_de_passe",
mot_de_passe.Text);
commd.Connection = cnx;
OdbcDataReader dtr;
try
{
dtr = commd.ExecuteReader();
if (dtr.Read())
{
if (dtr.GetString(2) == "a")
{
this.MdiParent.Menu.MenuItems[1].Visible = true;
this.MdiParent.Menu.MenuItems[2].Visible = true;
this.MdiParent.Menu.MenuItems[3].Visible = true;
this.MdiParent.Menu.MenuItems[4].Visible = true;
this.MdiParent.Menu.MenuItems[5].Visible = true;
}
else
{
this.MdiParent.Menu.MenuItems[3].Visible = true;
this.MdiParent.Menu.MenuItems[4].Visible = true;
}
this.MdiParent.Menu.MenuItems[0].MenuItems[0].Text = "Deconnecter";
this.MdiParent.Text = this.MdiParent.Text + "
*********** La personne connectée est: " + dtr.GetString(5) + " " +
dtr.GetString(3) + " " + dtr.GetString(4) + " ***********";
this.Close();
}
else
MessageBox.Show(this, "Login ou Mot de passe invalide", "",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception KINGREX)
{
MessageBox.Show(this, "Login ou Mot de
passe invalide", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
compte.Text = KINGREX.ToString();
}
}
}
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.Odbc;
namespace MINDONGO_FACTURATION_DEVIS
{
/// <summary>
/// Required designer variable.
/// </summary>
public class UTILISATEUR : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBoxloginut;
private System.Windows.Forms.Button bt_valider;
private System.Windows.Forms.Button bt_annuler;
private System.Windows.Forms.TextBox logine;
private System.Windows.Forms.TextBox pass;
private System.Windows.Forms.Label Login;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ListBox typeUser;
private System.Windows.Forms.GroupBox tt;
private System.Windows.Forms.RadioButton feminin;
private System.Windows.Forms.RadioButton Masculin;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txt_prenom;
private System.Windows.Forms.TextBox txt_nom;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label1;
private System.ComponentModel.IContainer components =
null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed
resources should be disposed; otherwise, false.</param>
public UTILISATEUR()
{
//
// Requis pour la prise en charge du Concepteur Windows
Forms
//
InitializeComponent();
//
// TODO : ajoutez le code du constructeur après l'appel
à InitializeComponent
//
}
protected override void Dispose(bool
disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not
modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
private void bt_valider_Click(object sender,
System.EventArgs e)
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
int KING;
try
{
cnx.Open();
}
catch
{
MessageBox.Show("Erreure de la Connexion");
}
finally
{
OdbcCommand comdKING;
comdKING=new OdbcCommand("select * from utilisateur where
login=?",cnx);
comdKING.Parameters.Add("login",logine.Text);
comdKING.Connection=cnx;
OdbcDataReader dtr;
try
{
dtr=comdKING.ExecuteReader();
if (dtr.Read())
{
MessageBox.Show(this, "Login Existant", "",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (logine.Text != "" && pass.Text != "" &&
typeUser.SelectedItem.ToString() != "" && txt_prenom.Text != ""
&& txt_nom.Text != "" && (Masculin.Checked == true ||
feminin.Checked == true))
{
dtr.Close();
OdbcCommand cmdRex = new OdbcCommand("insert into utilisateur
values(?,?,?,?,?,?)", cnx);
cmdRex.Parameters.Add("login",
logine.Text);
cmdRex.Parameters.Add("mot_de_passe",
pass.Text);
if (typeUser.SelectedItem.ToString()
== "")
cmdRex.Parameters.Add("type",
"u");
if (typeUser.SelectedItem.ToString()
== "Administrateur")
cmdRex.Parameters.Add("type",
"a");
if (typeUser.SelectedItem.ToString()
== "utilisateur")
cmdRex.Parameters.Add("type",
"u");
cmdRex.Parameters.Add("prenom",
txt_prenom.Text.ToLower());
cmdRex.Parameters.Add("nom",
txt_nom.Text.ToUpper());
if (Masculin.Checked == true)
cmdRex.Parameters.Add("sexe",
"Monsieur");
if (feminin.Checked == true)
cmdRex.Parameters.Add("sexe",
"Madame/Mademoiselle");
KING = cmdRex.ExecuteNonQuery();
MessageBox.Show(this, "Utilisateur ajouté", "",
MessageBoxButtons.OK, MessageBoxIcon.Information);
logine.Text = "";
pass.Text = "";
}
else
MessageBox.Show(this, "Veuiller
remplir tous les champs", "", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
catch
{
MessageBox.Show(this,"Erreure du
System","",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
cnx.Close();
}
private void bt_annuler_Click(object sender,
System.EventArgs e)
{
this.Close();
}
}
}
using System;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace MINDONGO_FACTURATION_DEVIS
{
public class GERER_LE_CLIENT : System.Windows.Forms.Form
{
private System.Data.Odbc.OdbcConnection KING_CLI;
private System.Windows.Forms.ImageList REX_IMAGE;
private System.Windows.Forms.ToolBar tlb_KING;
private System.Windows.Forms.ToolBarButton
Enregistrer;
private System.Windows.Forms.ToolBarButton IMPRIMER;
private System.Windows.Forms.ToolBarButton SEPARA1;
private System.Windows.Forms.ToolBarButton ACTUALISER;
private System.Windows.Forms.ToolBarButton VALIDER;
private System.Windows.Forms.ToolBarButton SUPPRIMER;
private System.Windows.Forms.ToolBarButton SEPDEUX;
private System.Windows.Forms.ToolBarButton PREMIER;
private System.Windows.Forms.ToolBarButton PRECEDENT;
private System.Windows.Forms.ToolBarButton SUIVANTS;
private System.Windows.Forms.ToolBarButton DERNIER;
private System.Windows.Forms.ToolBarButton SEPTROIS;
private System.Windows.Forms.ToolBarButton RETOUR;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Button bt_quitt;
private System.Windows.Forms.Button bt_ajout;
private System.Windows.Forms.TextBox prenom;
private System.Windows.Forms.TextBox nom;
private System.Windows.Forms.TextBox code_client;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox fax;
private System.Windows.Forms.TextBox e_mail;
private System.Windows.Forms.TextBox compte_bancaire;
private System.Windows.Forms.TextBox banque;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox societe;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.DateTimePicker
date_naissance;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox lieu_naissance;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox adresse;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tel;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
public GERER_LE_CLIENT()
{
//
// Requis pour la prise en charge du Concepteur Windows
Forms
//
InitializeComponent();
//
// TODO : ajoutez le code du constructeur après l'appel
à InitializeComponent
//
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components =
null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed
resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
void Initia()
{
/******************************************************************************************/
//Génération automatique du nouvel code
utilisateur
/******************************************************************************************/
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
System.Data.Odbc.OdbcCommand cmd = new
System.Data.Odbc.OdbcCommand("select max(code_client) from client",cnx);
cmd.Connection = cnx;
cnx.Open();
OdbcDataReader dtr = cmd.ExecuteReader();
dtr.Read();
code_client.Text =""+(dtr.GetInt32(0)+1);
dtr.Close();
cnx.Close();
}
void save()
{
/******************************************************************************************/
//new customer
/******************************************************************************************/
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
try
{
cnx.Open();
}
catch
{
MessageBox.Show("Echec de la Connexion");
}
finally
{
int SHEKINAH;
System.Data.Odbc.OdbcCommand commd = new
System.Data.Odbc.OdbcCommand("insert into
client(code_client,nom,prenom,societe,date_naissance,lieu_naissance,adresse,tel,fax,e_mail,compte_bancaire,banque)
values(?,?,?,?,?,?,?,?,?,?,?,?)", cnx);
commd.Parameters.Add("code_client",
Convert.ToDecimal(code_client.Text));
commd.Parameters.Add("nom",
nom.Text.ToUpper());
commd.Parameters.Add("prenom",
prenom.Text.ToUpper());
if (societe.Text != "")
commd.Parameters.Add("societe",
societe.Text);
else
commd.Parameters.Add("societe",
"anonyme");
commd.Parameters.Add("date_naissance",
@Convert.ToDateTime(date_naissance.Text));
commd.Parameters.Add("lieu_naissance",
lieu_naissance.Text);
if (adresse.Text != "")
commd.Parameters.Add("adresse",
adresse.Text);
else
commd.Parameters.Add("adresse",
"anonyme");
if (tel.Text != "")
commd.Parameters.Add("tel",
@Convert.ToDecimal(tel.Text));
else
commd.Parameters.Add("tel",
@Convert.ToDecimal("00000000"));
if (fax.Text != "")
commd.Parameters.Add("fax",
@Convert.ToDecimal(fax.Text));
else
commd.Parameters.Add("fax",
@Convert.ToDecimal("00000000"));
if (e_mail.Text != "")
commd.Parameters.Add("e_mail",
e_mail.Text);
else
commd.Parameters.Add("e_mail", "anonyme");
commd.Parameters.Add("compte_bancaire",
compte_bancaire.Text);
commd.Parameters.Add("banque", banque.Text);
try
{
if (nom.Text != "" && prenom.Text !=
"" && date_naissance.Text != "" && lieu_naissance.Text != ""
&& tel.Text != "" && banque.Text != "" &&
compte_bancaire.Text != "")
{
SHEKINAH = commd.ExecuteNonQuery();
commd.Parameters.Clear();
MessageBox.Show(this, "Le Client a été
Ajouté", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
//MAB
Initia();
code_client.Text = "";
nom.Text = "";
prenom.Text = "";
societe.Text = "";
date_naissance.Text = "";
lieu_naissance.Text = "";
adresse.Text = "";
tel.Text = "";
fax.Text = "";
e_mail.Text = "";
compte_bancaire.Text = "";
banque.Text ="";
}
else
MessageBox.Show(this, "Vous devez remplir
au moins les champs Obligatoire * ", "", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch
{
MessageBox.Show(this, "Client déja
existant", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not
modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
void
numéric(System.Windows.Forms.KeyPressEventArgs e)
{
//Verification de champ numérique
if (!char.IsDigit(e.KeyChar))
e.Handled = true;
}
private void tlb_KING_ButtonClick(object sender,
ToolBarButtonClickEventArgs e)
{
switch (tlb_KING.Buttons.IndexOf(e.Button))
{
case 0:
save();
Initia();
break;
case 12:
this.Close();
break;
}
}
private void GERER_LE_CLIENT_Load(object sender,
EventArgs e)
{
Initia();
}
private void bt_ajout_Click(object sender, EventArgs
e)
{
save();
Initia();
}
private void bt_quitt_Click(object sender, EventArgs
e)
{
this.Close();
}
private void tel_KeyPress(object sender,
KeyPressEventArgs e)
{
numéric(e);
}
private void fax_KeyPress(object sender,
KeyPressEventArgs e)
{
numéric(e);
}
private void compte_bancaire_KeyPress(object sender,
KeyPressEventArgs e)
{
numéric(e);
}
}
//************************************************************
using System;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace MINDONGO_FACTURATION_DEVIS
{
public class UPDATE_ART : System.Windows.Forms.Form
{
private System.Windows.Forms.ToolBarButton sep2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Button rechrch;
private System.Windows.Forms.TextBox rech_num_article;
private System.Windows.Forms.DataGrid dKING_article;
private System.Windows.Forms.ToolBarButton tBB_delete;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolBarButton
tBB_valider;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ToolBarButton
tBB_refresh;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ToolBarButton tBB_print;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.ToolBarButton sep1;
private System.Windows.Forms.TextBox qte_en_stock;
private System.Windows.Forms.ToolBarButton tBB_first;
private System.Windows.Forms.Label lblenre;
private System.Drawing.Printing.PrintDocument pdfirst;
private System.Windows.Forms.ToolBarButton
tBB_previous;
private System.Windows.Forms.ToolBarButton tBB_next;
private System.Windows.Forms.ToolBarButton tBB_last;
private System.Windows.Forms.ToolBarButton sep3;
private System.Windows.Forms.ToolBarButton tBB_quit;
private System.Windows.Forms.Button cmdsvt;
private System.Windows.Forms.Button cmdprecdent;
private System.Windows.Forms.Button cmdDernier;
private System.Windows.Forms.Button cmd1er;
private System.Windows.Forms.ToolBarButton tBB_save;
private System.Windows.Forms.TextBox type_article;
private System.Windows.Forms.TextBox designation;
private System.Windows.Forms.TextBox tva_article;
private System.Windows.Forms.TextBox num_article;
private System.Windows.Forms.TextBox fiche_tech;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox prix_unitaire;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.PrintDialog pdlone;
private System.Windows.Forms.ImageList REX_IMAGE;
private System.Windows.Forms.ToolBar tlb_KING;
private System.Windows.Forms.ToolBarButton
Enregistrer;
private System.Windows.Forms.ToolBarButton IMPRIMER;
private System.Windows.Forms.ToolBarButton SEPARA1;
private System.Windows.Forms.ToolBarButton ACTUALISER;
private System.Windows.Forms.ToolBarButton VALIDER;
private System.Windows.Forms.ToolBarButton SUPPRIMER;
private System.Windows.Forms.ToolBarButton SEPDEUX;
private System.Windows.Forms.ToolBarButton PREMIER;
private System.Windows.Forms.ToolBarButton PRECEDENT;
private System.Windows.Forms.ToolBarButton SUIVANTS;
private System.Windows.Forms.ToolBarButton DERNIER;
private System.Windows.Forms.ToolBarButton SEPTROIS;
private System.Windows.Forms.ToolBarButton RETOUR;
//**les variables suivant, ns les ajoutons ns
même (manuellement)
int MINDONGOrowCount = 0;
int KINGindex=1;
int REXselec;
OdbcDataReader dtr;
public UPDATE_ART()
{
//
// Requis pour la prise en charge du Concepteur Windows
Forms
//
InitializeComponent();
//
// TODO : ajoutez le code du constructeur après l'appel
à InitializeComponent
//
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components =
null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed
resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not
modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
void suiv_ant()
{
if (KINGindex != MINDONGOrowCount)
{
KINGindex++;
lblenre.Text = "" + KINGindex + " / " +
MINDONGOrowCount;
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
cnx.Open();
OdbcCommand cmdm = new OdbcCommand("select *from
article");
cmdm.Connection = cnx;
dtr = cmdm.ExecuteReader();
for (int i = 0; i < KINGindex ; i++)
dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text =
dtr.GetInt32(3).ToString();
prix_unitaire.Text =
dtr.GetInt32(4).ToString();
tva_article.Text =
dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
cnx.Close();
}
if (KINGindex ==MINDONGOrowCount)
{
cmdsvt.Enabled = false;
SUIVANTS.Enabled = false;
}
cmdprecdent.Enabled = true;
PRECEDENT.Enabled = true;
dKING_article.UnSelect(REXselec);
dKING_article.Select(KINGindex - 1);
REXselec = KINGindex - 1;
}
void der_nier()
{
KINGindex = MINDONGOrowCount;
lblenre.Text = "" + KINGindex + " / " +
MINDONGOrowCount;
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
cnx.Open();
OdbcDataReader dtr;
OdbcCommand cmdb = new OdbcCommand("select *from
article");
cmdb.Connection = cnx;
dtr = cmdb.ExecuteReader();
for (int i = 0; i < KINGindex; i++) dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text = dtr.GetInt32(3).ToString();
prix_unitaire.Text = dtr.GetInt32(4).ToString();
tva_article.Text = dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
cmdsvt.Enabled = false;
SUIVANTS.Enabled = false;
cmdprecdent.Enabled = true;
PRECEDENT.Enabled = true;
dKING_article.UnSelect(REXselec);
dKING_article.Select(KINGindex - 1);
REXselec = KINGindex - 1;
cnx.Close();
}
void premier()
{
KINGindex = 1;
lblenre.Text = "" + KINGindex + " / "
+MINDONGOrowCount ;
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
cnx.Open();
OdbcDataReader dtr;
OdbcCommand cmdq = new OdbcCommand("select *from
article");
cmdq.Connection = cnx;
dtr = cmdq.ExecuteReader();
dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text = dtr.GetInt32(3).ToString();
prix_unitaire.Text = dtr.GetInt32(4).ToString();
tva_article.Text = dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
cmdprecdent.Enabled = false;
PRECEDENT.Enabled = false;
cmdsvt.Enabled = true;
SUIVANTS.Enabled = true;
dKING_article.UnSelect(REXselec);
dKING_article.Select(KINGindex - 1);
REXselec = KINGindex - 1;
cnx.Close();
}
void initialiser()
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
OdbcDataAdapter adptr = new OdbcDataAdapter("select
num_article,designation,qte_en_stock,prix_unitaire,prix_unitaire*qte_en_stock
as VALEUR from article", cnx);
DataSet dts = new DataSet();
try
{
adptr.Fill(dts, "article");
MINDONGOrowCount =
dts.Tables["article"].Rows.Count;
lblenre.Text = "" + KINGindex + " / " +
MINDONGOrowCount;
cnx.Open();
OdbcCommand cmde = new OdbcCommand("select *from
article");
dKING_article.SetDataBinding(dts, "article");
shw_ART(cnx,cmde);
cnx.Close();
dKING_article.Select(0);
REXselec = 0;
}
catch (Exception KING)
{
designation.Text = KING.ToString();
cmdprecdent.Enabled = false;
PRECEDENT.Enabled = true;
cmdsvt.Enabled = true;
SUIVANTS.Enabled = true;
}
}
void Prece_dent()
{
if (KINGindex != 1)
{
KINGindex--;
lblenre.Text = "" + KINGindex + " / " +
MINDONGOrowCount;
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
cnx.Open();
OdbcCommand cmdx = new OdbcCommand("select *from
article");
cmdx.Connection = cnx;
dtr = cmdx.ExecuteReader();
for (int i = 0; i < KINGindex; i++)
dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text =
dtr.GetInt32(3).ToString();
prix_unitaire.Text =
dtr.GetInt32(4).ToString();
tva_article.Text =
dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
cnx.Close();
}
if (KINGindex == 1)
{
cmdprecdent.Enabled = false;
PRECEDENT.Enabled = false;
}
cmdsvt.Enabled = true;
SUIVANTS.Enabled = true;
dKING_article.UnSelect(REXselec);
dKING_article.Select(KINGindex-1);
REXselec = KINGindex - 1;
}
void supprm()
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
try
{
cnx.Open();
}
catch
{
MessageBox.Show("erreur de la connection");
}
finally
{
OdbcCommand commde=new OdbcCommand("delete from article where
num_article="+@Convert.ToDecimal(num_article.Text),cnx);
try
{
int rex =
commde.ExecuteNonQuery();
MessageBox.Show(this, "un Article est
Supprimé", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
KINGindex--;
MINDONGOrowCount--;
Prece_dent();
}
catch (Exception DKING)
{
designation.Text =
DKING.ToString();
MessageBox.Show(this, "cet article
n'est pas supprimé", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
String sql2 = "select
num_article,designation,qte_en_stock from article";
ACTUALISER_dKING_article(sql2);
cnx.Close();
}
}
void Updateart()
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
try
{
cnx.Open();
}
catch
{
MessageBox.Show("erreur de la connection");
}
finally
{
OdbcCommand commd = new OdbcCommand("update article set
designation=?,type_article=?,qte_en_stock=?,prix_unitaire=?,tva_article=?,fiche_tech=?
where num_article=" + @Convert.ToDecimal(num_article.Text), cnx);
commd.Parameters.Add("designation",
designation.Text.ToUpper());
commd.Parameters.Add("type_article",
type_article.Text.ToUpper());
commd.Parameters.Add("qte_en_stock",
qte_en_stock.Text);
commd.Parameters.Add("prix_unitaire",
@Convert.ToInt32(prix_unitaire.Text));
commd.Parameters.Add("tva_article",
@Convert.ToDouble(tva_article.Text));
commd.Parameters.Add("fiche_tech",
fiche_tech.Text);
try
{
int rex = commd.ExecuteNonQuery();
MessageBox.Show(this, "un article a
été modifié", "", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch
{
MessageBox.Show(this, "cet article n'est pas
enregistré", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
String sql = "select
num_article,designation,qte_en_stock,prix_unitaire,prix_unitaire*qte_en_stock
as VALEUR from article";
ACTUALISER_dKING_article(sql);
Actualiser();
cnx.Close();
}
}
void REX_numeric(System.Windows.Forms.KeyPressEventArgs
e)
{
if (!char.IsDigit(e.KeyChar))
e.Handled = true;
}
void ctrl_num(System.Windows.Forms.KeyPressEventArgs
e)
{
//for numeric textbox
if (!char.IsDigit(e.KeyChar))
e.Handled = true;
}
void ACTUALISER_dKING_article(String PATHY)
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
OdbcDataAdapter adptr = new
OdbcDataAdapter(PATHY,cnx);
DataSet dts = new DataSet();
cnx.Open();
cnx.Close();
dKING_article.Refresh();
adptr.Fill(dts, "article");
dKING_article.SetDataBinding(dts, "article");
dKING_article.Refresh();
}
public void shw_ART(OdbcConnection cnx, OdbcCommand
cmde)
{
OdbcDataReader dtr;
cmde.Connection = cnx;
dtr = cmde.ExecuteReader();
dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text = dtr.GetInt32(3).ToString();
prix_unitaire.Text = dtr.GetInt32(4).ToString();
tva_article.Text = dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
}
public void Actualiser()
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
OdbcCommand cmd = new OdbcCommand("select * from
article");
try
{
OdbcDataReader dtr;
cnx.Open();
cmd.Connection = cnx;
dtr = cmd.ExecuteReader();
int KING = 1;
while (KING < KINGindex + 1) { dtr.Read();
KING++; }
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text =
dtr.GetInt32(3).ToString();
prix_unitaire.Text =
dtr.GetInt32(4).ToString();
tva_article.Text =
dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
dtr.Close();
cnx.Close();
}
catch (Exception MINDONGO)
{
designation.Text = MINDONGO.ToString();
}
}
private void dKING_article_CurrentCellChanged(object
sender, System.EventArgs e)
{
KINGindex = dKING_article.CurrentCell.RowNumber +
1;
lblenre.Text = "" + KINGindex + " / " +
MINDONGOrowCount;
OdbcDataReader dtr;
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
cnx.Open();
OdbcCommand cmdK = new OdbcCommand("select *from
article");
cmdK.Connection = cnx;
dtr = cmdK.ExecuteReader();
for (int i = 0; i < KINGindex; i++) dtr.Read();
num_article.Text = dtr.GetInt32(0).ToString();
designation.Text = dtr.GetString(1);
type_article.Text = dtr.GetString(2);
qte_en_stock.Text = dtr.GetInt32(3).ToString();
prix_unitaire.Text = dtr.GetInt32(4).ToString();
tva_article.Text = dtr.GetDouble(5).ToString();
fiche_tech.Text = dtr.GetString(6);
cnx.Close();
}
private void UPDATE_ART_Load(object sender, EventArgs
e)
{
initialiser();
}
private void rechrch_Click(object sender, EventArgs e)
{
OdbcConnection cnx = new
OdbcConnection("DSN=KINGMINDONGO");
String KING="";
OdbcDataAdapter adptr = new OdbcDataAdapter("select * from
article", cnx);
try
{
cnx.Open();
KING ="select*from article where num_article=" +
@Convert.ToDecimal(rech_num_article.Text);
OdbcCommand cmdy = new OdbcCommand(KING);
shw_ART(cnx, cmdy);
}
catch
{
}
finally
{
cnx.Close();
}
}
private void cmd1er_Click(object sender, EventArgs e)
{
premier();
}
private void cmdprecdent_Click(object sender, EventArgs
e)
{
Prece_dent();
}
private void cmdsvt_Click(object sender, EventArgs e)
{
suiv_ant();
}
private void cmdDernier_Click(object sender, EventArgs
e)
{
der_nier();
}
private void qte_en_stock_KeyPress(object sender,
KeyPressEventArgs e)
{
REX_numeric(e);
}
private void tlb_KING_ButtonClick(object sender,
ToolBarButtonClickEventArgs e)
{
switch (tlb_KING.Buttons.IndexOf (e.Button))
{
case 1:
pdlone.ShowDialog();
break;
case 3:
Actualiser();
break;
case 4:
Updateart();
break;
case 5:
supprm();
break;
case 7:
premier();
break;
case 8:
Prece_dent();
break;
case 9:
suiv_ant ();
break;
case 10:
der_nier ();
break;
case 12:
this.Close();
break;
}
}
}
}
|