private void enregistrerclient() { if (valtexte(raisonsociale) == "" && valtexte(nom) == "" && valtexte(prenom) == "") { uf.message_info("Veuillez saisir la raison sociale, ou les champs nom/prénom !"); return; } if (politesse.SelectedIndex < 0) { uf.message_info("Veuillez définir la politesse !"); return; } string champ = ""; string val = ""; champ = "idclient, socligne, nom, prenom, idpolitesse, adresse1, adresse2, co, idville, telpro, telmob, fax, email"; if (etat == 2) { refclient.Text = numclisuivant().ToString(); } val = valtexte(refclient) + "$" + valtexte(raisonsociale) + "$" + valtexte(nom) + "$" + valtexte(prenom) + "$" + uf.valcombo(politesse) + "$" + valtexte(adresse1) + "$" + valtexte(adresse2) + "$" + valtexte(co) + "$" + npa.IndCombo + "$" + valtexte(telpro) + "$" + valtexte(telmob) + "$" + valtexte(fax) + "$" + valtexte(email); if (etat == 2) { string newid = uf.executeSQL(comrealvista, "fact_client", champ, val, etat, ""); if (etatajoutimport > 0) { ((f_importation)(fImport)).gvins.CurrentRow.Cells["idclient"].Value = newid; remonterlignesuivant(); return; } uf.afficherInfo(this, reqdon.Replace("ORDER", "WHERE idclient=" + newid + " ORDER"), comrealvista, gv_client, ""); annule(); } else if (etat == 1) { uf.executeSQL(comrealvista, "fact_client", champ, val, etat, "idclient = " + gv_client.CurrentRow.Cells["g_refclient"].Value.ToString()); if (uf.confirmer_questionON(this, "Archiver la dernière adresse ?") == DialogResult.Yes) { enregistrerarchive(); } curligne = gv_client.CurrentRow.Index; annule(); } }
private void bt_valid_Click(object sender, EventArgs e) { string mtt = mttpaye.Text.Trim(); decimal dmtt = 0; decimal.TryParse(mtt, out dmtt); string postbanq = "1"; if (ck_banque.Checked) { postbanq = "2"; } if (dmtt <= 0) { uf.message_info("Veuillez saisir le montant payé !"); return; } int numfolio = int.Parse(Fmain.Maxsuivant(Fmain.nombasecompta + ".cpta_mouvement", "numfolio", "year(datemouvement) = " + DateTime.Now.Year.ToString())); string idcomptedebit = uf.ValeurParCond(comrech, Fmain.nombasecompta + ".cpta_compte", "idcompte, codecompte", "idcompte", "codecompte = " + Fmain.comptedebit); string idcompteb = uf.ValeurParCond(comrech, Fmain.nombasecompta + ".cpta_compte", "idcompte, codecompte", "idcompte", "codecompte = " + Fmain.compteb); string typetrans = "0"; //tft banque if (typetransfert.SelectedIndex == 1) { typetrans = "1"; } string textedeb = coordpayeur.Text.Trim(); string datyp = uf.getDateSQL(datepaiement.Value); //Comptabilisation string newid = uf.executeSQL(comrealvistamod, Fmain.nombasecompta + ".cpta_mouvement", "numfolio,datesaisie,datemouvement,typeecriture,idcompte,codecompte,idcomptec,codecomptec,libelledetail,entree,sortie", numfolio.ToString() + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "1" + "$" + idcompteb + "$" + Fmain.compteb + "$" + idcomptedebit + "$" + Fmain.comptedebit + "$" + "Paiement " + numfact + "-" + textedeb + "-" + comptepayeur.Text.Trim() + "$" + dmtt.ToString() + "$" + "0", 2, ""); string champ = "typepaiement, postebanque, datesaisie, datepaiement, identreprise, idclient, numfacture, montant, refpaiement, coordpayeur, comptepaiement, typetransfert, idmouvementpaye"; string valeur = typepaiement.SelectedIndex.ToString() + "$" + postbanq + "$" + uf.getDateSQL(datesaisie.Value) + "$" + uf.getDateSQL(datepaiement.Value) + "$" + Fmain.identreprisesel + "$" + int.Parse(numfact.Substring(4, 2)).ToString() + "$" + numfact + "$" + dmtt.ToString() + "$" + refpaiement.Text.Trim() + "$" + textedeb + "$" + comptepayeur.Text.Trim() + "$" + typetrans + "$" + newid; if (typemod == 2) //modif { uf.executeSQL(comrealvistamod, "fact_paiement", champ, valeur, 1, "idpaiement = " + gv_listepaiement.CurrentRow.Cells["g_idpaiement"].FormattedValue.ToString()); chargerpaiement(); } else { uf.executeSQL(comrealvistamod, "fact_paiement", champ, valeur, 2, ""); //Si solde = 0 uf.executeSQL(comrealvistamod, "fact_facturation", "rappel", "0", 2, "reffacturedeltareal='" + numfact + "'"); DialogResult = DialogResult.OK; } }
private void bt_valider_Click(object sender, EventArgs e) { if (uf.confirmer_questionON(this, "Etes-vous sûre de valider ?") == DialogResult.Yes) { DataTableReader rr = realvistaDataSet.facturation.CreateDataReader(); string numf = ""; decimal mttbrutmoinsrabais = 0; decimal mttapayer = 0; int numfolio = 0; string idcomptedebit = ""; string idcomptefacture = ""; string nomprenom = ""; if (!brappel) { numfolio = int.Parse(Fmain.Maxsuivant(Fmain.nombasecompta + ".cpta_mouvement", "numfolio", "year(datemouvement) = " + DateTime.Now.Year.ToString())); idcomptedebit = uf.ValeurParCond(comrech, Fmain.nombasecompta + ".cpta_compte", "idcompte, codecompte", "idcompte", "codecompte = " + Fmain.comptedebit); idcomptefacture = uf.ValeurParCond(comrech, Fmain.nombasecompta + ".cpta_compte", "idcompte, codecompte", "idcompte", "codecompte = " + Fmain.comptefacture); } while (rr.Read()) { if (numf != rr.GetValue(rr.GetOrdinal("fact_nofacture")).ToString()) { if (brappel) { if (numf != "") { uf.executeSQL(comrealvistamod, "fact_facturation", "dateecheance, rappel", string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancerappel")).ToString()))) + "$" + "##rappel+1", 1, "identreprise = " + Fmain.identreprisesel + " AND reffacturedeltareal = '" + numf + "'"); uf.executeSQL(comrealvistamod, "fact_procedures", "identreprise,idclient,numfacture,inouttype,initial,dateproc,typecourrier,echeanceproc", Fmain.identreprisesel + "$" + rr.GetValue(rr.GetOrdinal("iCli")).ToString() + "$" + numf + "$" + "out" + "$" + Fmain.InitUser + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "Rappel " + ((int.Parse(rr.GetValue(rr.GetOrdinal("fact_nbrrappel")).ToString())) + 1).ToString() + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancerappel")).ToString()))), 2, ""); } } else { if (numf != "") { string newid = uf.executeSQL(comrealvistamod, Fmain.nombasecompta + ".cpta_mouvement", "numfolio,datesaisie,datemouvement,typeecriture,idcompte,codecompte,idcomptec,codecomptec,libelledetail,entree,sortie", numfolio.ToString() + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "1" + "$" + idcomptedebit + "$" + Fmain.comptedebit + "$" + idcomptefacture + "$" + Fmain.comptefacture + "$" + numf + " " + nomprenom + "$" + uf.getFormatCur(mttapayer, false) + "$" + "0", 2, ""); uf.executeSQL(comrealvistamod, "fact_facturation", "dateimpression, dateecheance, idmouvementenvoye", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))) + "$" + newid, 1, "identreprise = " + Fmain.identreprisesel + " AND reffacturedeltareal ='" + numf + "'"); uf.executeSQL(comrealvistamod, "fact_procedures", "identreprise,idclient,numfacture,inouttype,initial,dateproc,typecourrier,echeanceproc", Fmain.identreprisesel + "$" + rr.GetValue(rr.GetOrdinal("iCli")).ToString() + "$" + numf + "$" + "out" + "$" + Fmain.InitUser + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "Facture" + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))), 2, ""); numfolio++; } mttapayer = 0; } numf = rr.GetValue(rr.GetOrdinal("fact_nofacture")).ToString(); } if (!brappel) { mttbrutmoinsrabais = rr.GetDecimal(rr.GetOrdinal("art_montantbrut")) - rr.GetDecimal(rr.GetOrdinal("art_rabaischf")); mttapayer += mttbrutmoinsrabais + (mttbrutmoinsrabais * decimal.Parse(rr.GetValue(rr.GetOrdinal("fact_tvapourcent")).ToString()) / 100); nomprenom = rr.GetString(rr.GetOrdinal("cli_nom")) + " " + rr.GetString(rr.GetOrdinal("cli_prenom")) + " " + rr.GetString(rr.GetOrdinal("cli_npa")) + " " + rr.GetString(rr.GetOrdinal("cli_ville")); } } if (numf != "") { if (brappel) { //uf.executeSQL(comrealvistamod, "fact_facturation", "dateecheance, rappel", string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))) + "$" + "##rappel+1", 1, "identreprise = " + Fmain.identreprisesel + " AND reffacturedeltareal = '" + numf + "'"); uf.executeSQL(comrealvistamod, "fact_facturation", "dateecheance, rappel", string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancerappel")).ToString()))) + "$" + "##rappel+1", 1, "identreprise = " + Fmain.identreprisesel + " AND reffacturedeltareal = '" + numf + "'"); uf.executeSQL(comrealvistamod, "fact_procedures", "identreprise,idclient,numfacture,inouttype,initial,dateproc,typecourrier,echeanceproc", Fmain.identreprisesel + "$" + rr.GetValue(rr.GetOrdinal("iCli")).ToString() + "$" + numf + "$" + "out" + "$" + Fmain.InitUser + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "Rappel " + ((int.Parse(rr.GetValue(rr.GetOrdinal("fact_nbrrappel")).ToString())) + 1).ToString() + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancerappel")).ToString()))), 2, ""); //Fmain.identreprisesel + "$" + rr.GetValue(rr.GetOrdinal("iCli")).ToString() + "$" + numf + "$" + "out" + "$" + Fmain.InitUser + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "Rappel" + rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString().Substring(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString().IndexOf("A") + 1) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))), 2, ""); } else { string newid = uf.executeSQL(comrealvistamod, Fmain.nombasecompta + ".cpta_mouvement", "numfolio,datesaisie,datemouvement,typeecriture,idcompte,codecompte,idcomptec,codecomptec,libelledetail,entree,sortie", numfolio.ToString() + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "1" + "$" + idcomptedebit + "$" + Fmain.comptedebit + "$" + idcomptefacture + "$" + Fmain.comptefacture + "$" + numf + " " + nomprenom + "$" + uf.getFormatCur(mttapayer, false) + "$" + "0", 2, ""); uf.executeSQL(comrealvistamod, "fact_facturation", "dateimpression, dateecheance, idmouvementenvoye", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))) + "$" + newid, 1, "identreprise = " + Fmain.identreprisesel + " AND reffacturedeltareal ='" + numf + "'"); uf.executeSQL(comrealvistamod, "fact_procedures", "identreprise,idclient,numfacture,inouttype,initial,dateproc,typecourrier,echeanceproc", Fmain.identreprisesel + "$" + rr.GetValue(rr.GetOrdinal("iCli")).ToString() + "$" + numf + "$" + "out" + "$" + Fmain.InitUser + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + "$" + "Facture" + "$" + string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(int.Parse(rr.GetValue(rr.GetOrdinal("ent_echeancejour")).ToString()))), 2, ""); numfolio++; } } this.DialogResult = DialogResult.OK; } }
private void bt_valider_Click(object sender, EventArgs e) { decimal dprix = 0; decimal.TryParse(uf.valtexte(edprix), out dprix); decimal drabaisp = 0; decimal drabaism = 0; decimal.TryParse(uf.valtexte(edrabaismontant), out drabaism); decimal.TryParse(uf.valtexte(edrabaispourcent), out drabaisp); if (unite.SelectedIndex < 0) { uf.AfficherErreur("Veuillez l'unité de cet article !"); return; } if (drabaisp > 0) { drabaism = 0; } if (dprix == 0) { uf.AfficherErreur("Veuillez entrer le prix de cet article !"); return; } if (etat == 2 && dprix == 0) { uf.AfficherErreur("Veuillez entrer le prix de cet article !"); return; } string champ = "identreprise, codearticle, descriptif_ligne1, descriptif_ligne2, descriptif_ligne3, descriptif_ligne4, descriptif_ligne5, remarque, idunite"; string val = "115 $ ART 02 $ DESCR 2 $ remarque 2 $ 3 $ 20.30"; val = Fmain.identreprisesel + "$" + valtexte(codearticle) + "$" + valtexte(descriptif_ligne1) + "$" + valtexte(descriptif_ligne2) + "$" + valtexte(descriptif_ligne3) + "$" + valtexte(descriptif_ligne4) + "$" + valtexte(descriptif_ligne5) + "$" + valtexte(remarque) + "$" + uf.valcombo(unite); if (etat == 2) { string newid = uf.executeSQL(comrealvista, "fact_articles", champ, val, etat, ""); uf.executeSQL(comrealvista, "fact_prix", "idarticleprix, dateprix, prix", newid + "$" + string.Format("{0:yyyy-MM-dd}", eddateprix.Value) + "$" + uf.getFormatCur(dprix), 2, ""); if (drabaisp > 0 || drabaism > 0) { uf.executeSQL(comrealvista, "fact_rabais", "idarticlerabais, dateranaisde, dateranaisa, rabaispourcent, rabaismontant", newid + "$" + string.Format("{0:yyyy-MM-dd}", eddaterabaisde.Value) + "$" + string.Format("{0:yyyy-MM-dd}", eddaterabaisa.Value) + "$" + uf.getFormatCur(edrabaispourcent) + "$" + uf.getFormatCur(edrabaismontant), 2, ""); } } else if (etat == 1) { uf.executeSQL(comrealvista, "fact_articles", champ, val, etat, "idarticle = " + gv_article.CurrentRow.Cells["g_idarticle"].Value.ToString()); } if (etat == 1) { curligne = gv_article.CurrentRow.Index; } else { curligne = gv_article.RowCount - 1; } uf.afficherInfo(this, reqdon, comrealvista, gv_article, ""); annule(); }
private void bt_valider_Click(object sender, EventArgs e) { string champ = ""; string val = ""; //if (tauxtva.selec == "") // tauxtva.Text = "0"; if (iddeltareal.Text.Trim() == "0") { iddeltareal.Text = ""; } champ = "socligne1, socligne2, idtauxtva, numtva, echeance, echeancerappel, infos, iddeltareal, basededonnees, comptedebit,compteb,comptefacture, pub, texterappel"; //adresse, idville, telpro, telmob, fax, email, siteweb, if (iddeltareal.Text.Trim() == "") { val = valtexte(socligne1) + "$" + valtexte(socligne2) + "$" + tauxtva.SelectedValue.ToString() + "$" + valtexte(numtva) + "$" + valtexte(nbrecheance) + "$" + valtexte(echeancerappel) + "$" + valtexte(infos) + "$" + "0" + "$" + valtexte(basededonnees) + "$" + valtexte(compte) + "$" + valtexte(compteb) + "$" + valtexte(comptefacture) + "$" + pub.Text + "$" + texterappel.Text; //+ valtexte(adresse1) + "$" + npa.IndCombo + "$" + valtexte(telpro) + "$" + valtexte(telmob) + "$" //"$" + valcheck(fraispourcent) + +valtexte(fax) + "$" + valtexte(email) + "$" + valtexte(siteweb) + "$" + valtexte(tauxtva) + "$" } else { val = "null" + "$" + "null" + "$" + tauxtva.SelectedValue.ToString() + "$" + valtexte(numtva) + "$" + valtexte(nbrecheance) + "$" + valtexte(echeancerappel) + "$" + valtexte(infos) + "$" + valtexte(iddeltareal) + "$" + valtexte(basededonnees) + "$" + valtexte(compte) + "$" + valtexte(compteb) + "$" + valtexte(comptefacture) + "$" + pub.Text + "$" + texterappel.Text; } if (etat == 2) { uf.executeSQL(comrealvista, "fact_entreprise", champ, val, etat, ""); } else if (etat == 1) { uf.executeSQL(comrealvista, "fact_entreprise", champ, val, etat, "identreprise = " + g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString()); } if (etat == 1) { curligne = g_client.CurrentRow.Index; } else { curligne = g_client.RowCount - 1; } uf.afficherInfo(this, reqdon, comrealvista, g_client, "politesse"); annule(); }