private void bt_suppr_Click(object sender, EventArgs e)
 {
     if (uf.confirmer_questionON(this, "Etes-vous sûre de supprimer cette ligne ?") == DialogResult.No)
     {
         annule();
         return;
     }
     uf.executeSQL(comrealvista, "fact_entreprise", "", "", 3, "identreprise = " + g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString());
     uf.executeSQL(comrealvista, "fact_entreprisefonction", "", "", 3, "identreprise = " + g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString());
     uf.executeSQL(comrealvista, "fact_fraisprocedure", "", "", 3, "identreprise = " + g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString());
     g_client.Rows.Remove(g_client.CurrentRow);
     annule();
 }
Exemple #2
0
 private void bt_suppr_Click(object sender, EventArgs e)
 {
     if (uf.ValeurParCond(comrealvista, "fact_facturation", "idfacture, idprix", "idfacture", "idarticle =" + gv_article.CurrentRow.Cells["g_idarticle"].FormattedValue.ToString() + " GROUP BY idprix") != "")
     {
         uf.AfficherErreur("Attention, il y a déjà une facture qui utilise cet article !");
         return;
     }
     if (uf.confirmer_questionON(this, "Etes-vous sûre de supprimer cette ligne ?") == DialogResult.No)
     {
         annule();
         return;
     }
     uf.executeSQL(comrealvista, "fact_articles", "", "", 3, "idarticle = " + gv_article.CurrentRow.Cells["g_idarticle"].Value.ToString());
     gv_article.Rows.Remove(gv_article.CurrentRow);
     annule();
 }
Exemple #3
0
        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_psuppr_Click(object sender, EventArgs e)
 {
     if (uf.confirmer_questionON(this, "Etes-vous sûre de supprimer cette ligne de paiement ?") == DialogResult.Yes)
     {
         uf.executeSQL(comrealvistamod, "fact_paiement", "", "", 3, "idpaiement = " + gv_listepaiement.CurrentRow.Cells["g_idpaiement"].FormattedValue.ToString());
         chargerpaiement();
         bt_annul.DialogResult = DialogResult.OK;
     }
 }
Exemple #5
0
        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;
            }
        }