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_valideretat_Click(object sender, EventArgs e) { /*SELECT '' as dateecriture, '' as numecriture, 0 as idmouvement, 0 as idcompte, '' as codecompte, 0 as idcomptec, '' as codecomptec, '' as libelle, 0.00 as entree, 0.00 as sortie from fact_facturation*/ this.reportViewer1.RefreshReport(); string tri = ""; Microsoft.Reporting.WinForms.ReportDataSource dd = null; reportViewer1.LocalReport.ReportPath = Application.StartupPath + "\\Fact_modele\\fact_recapfacture.rdlc"; dd = new Microsoft.Reporting.WinForms.ReportDataSource("FactDataSet"); tri = "SELECT mouv.numfolio as numecriture, date_format(mouv.datemouvement, '%d.%m.%y') as dateecriture, mouv.idmouvement, mouv.idcompte, mouv.codecompte, mouv.idcomptec, mouv.codecomptec, mouv.libelledetail as libelle, mouv.entree, mouv.sortie, fact.identreprise "; if (ck_envoye.Checked) { tri += " FROM fact_facturation fact INNER JOIN " + Fmain.nombasecompta + ".cpta_mouvement mouv ON mouv.idmouvement = fact.idmouvementenvoye AND fact.identreprise = " + Fmain.identreprisesel + " AND mouv.datesaisie BETWEEN '" + uf.getDateSQL(datedeb.Value) + "' AND '" + uf.getDateSQL(datefin.Value) + "' group by fact.reffacturedeltareal ORDER BY mouv.numfolio desc"; } else { tri += " FROM fact_paiement fact INNER JOIN " + Fmain.nombasecompta + ".cpta_mouvement mouv ON mouv.idmouvement = fact.idmouvementpaye AND fact.identreprise = " + Fmain.identreprisesel + " AND mouv.datesaisie BETWEEN '" + uf.getDateSQL(datedeb.Value) + "' AND '" + uf.getDateSQL(datefin.Value) + "' group by mouv.numfolio ORDER BY mouv.numfolio desc"; } realvistaDataSetTableAdapters.recapfactureTableAdapter recapfacture = new realvistaDataSetTableAdapters.recapfactureTableAdapter(); clientBindingSource.ResetBindings(false); recapfacture.ClearBeforeFill = true; clientBindingSource.DataMember = "recapfacture"; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(dd); string txt = " du " + string.Format("{0:dd.MM.yyyy}", datedeb.Value); if (datedeb.Value != datefin.Value) { txt = txt + " au " + string.Format("{0:dd.MM.yyyy}", datefin.Value); } if (ck_envoye.Checked) { reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("typereport", "ENVOYEES" + txt)); } else { reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("typereport", "PAYEES" + txt)); } reportViewer1.LocalReport.DataSources[0].Value = clientBindingSource; recapfacture.Fill(realvistaDataSet.recapfacture, tri); if (clientBindingSource.Position == -1) { uf.message_info("Il n'y a pas de données !"); return; } this.Top = this.Owner.Top; this.Left = this.Owner.Left; pboutons.Visible = false; this.Width = 1376; this.Height = 846; reportViewer1.Show(); reportViewer1.Visible = true; reportViewer1.RefreshReport(); reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; reportViewer1.ZoomPercent = 100; }