示例#1
0
 public void BTN_APERçU_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         ReportDocument rpt = new ReportDocument();
         if (CLIENT_APP_PARAM.InvoicePrintOption == "Ticket")
         {
             rpt = new CHM_FACTURE.CHM_FACTURE_TICKET_CLIENT();
             //rpt.SetDataSource(CLIENT_APP_PARAM.GEST.P_FACTURE.ImprimerTICET_FACTURE_CLIENT((((DataRowView)bs_facture.Current)["CODE_FACTURE"]).ToString()));
             rpt.SetDataSource(CLIENT_APP_PARAM.gcws.ImprimerTICET_FACTURE_CLIENT(CODE_FACTURE_));
         }
         else
         {
             rpt = new CHM_FACTURE.CHM_RPT_FACTURE();
             rpt.SetDataSource(CLIENT_APP_PARAM.gcws.Imprimer_FACTURE_CLIENT(CODE_FACTURE_));
             rpt.PrintOptions.PrinterName = CLIENT_APP_PARAM.ReportPrinter;
         }
         CHM_ETATS f = new CHM_ETATS();
         f.CHM_Aperçu_document.ReportSource = rpt;
         f.WindowState = FormWindowState.Maximized;
         this.Cursor   = Cursors.Default;
         f.ShowDialog();
     }
     catch (Exception er)
     {
         this.Cursor = Cursors.Default;
         MessageBox.Show(er.Message);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
示例#2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CHM_RPT_FACTURE rpt = new CHM_RPT_FACTURE();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#3
0
        private void BTN_ENREGISTRER_Click(object sender, EventArgs e)
        {
            #region Verification des champs
            if (xtraTabControl1.SelectedTabPageIndex == 0 && RS_CLIENT.Text == string.Empty)
            {
                MessageBox.Show("Veuillez sélectionner le client!", this.Text);
                return;
            }
            #endregion
            if (dS_MOUV1.LIGNE_FACTURE.Rows.Count > 0 && MessageBox.Show("Etes vous sûres d'enregistrer la facture?", "Enregistrement facture", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                this.Cursor = Cursors.WaitCursor;
                try
                {
                    DataTable dtDetailsFc = new DataTable("dtDetailsFc");
                    foreach (DataColumn c in dS_MOUV1.LIGNE_FACTURE.Columns)
                    {
                        DataColumn col = new DataColumn(c.ColumnName, c.DataType);
                        dtDetailsFc.Columns.Add(col);
                    }

                    foreach (DataRow dr in dS_MOUV1.LIGNE_FACTURE.Rows)
                    {
                        dtDetailsFc.ImportRow(dr);
                    }

                    Application.DoEvents();
                    string[] bl = new string[bl_facture.Count];
                    for (int i = 0; i < bl_facture.Count; i++)
                    {
                        bl[i] = bl_facture[i];
                    }
                    //CHM_GESTION_COMERCIALE.RESULT_QUERY res = CLIENT_APP_PARAM.GEST.P_FACTURE.INSERT_FACTURE(DATE_FACTURE.Value, CODE_CLIENT, HT.Text, TVA.Value.ToString(), TTC.Value.ToString(), TAUX_REMISE.Value.ToString(), TTC.Value.ToString(), TIMBRE.Value.ToString(), NP.Value.ToString(), ML.Text, false, "Non reglée", TTC.Value.ToString(), CODE_MAG, CLIENT_APP_PARAM.Fenetre_principale.code_user, CLIENT_APP_PARAM.Fenetre_principale.prenom_user, CLIENT_APP_PARAM.Fenetre_principale.nom_user, REMARQUE, dt_lg_b_liv);

                    decimal credit = TIMBRE.Value;
                    foreach (DataRow dr in dS_MOUV1.V_PIECE_CLIENT_SANS_FACTURE.Rows)
                    {
                        if (dr["CHECKED"].ToString() == "True")
                        {
                            credit += (decimal)dr["RESTE_NP"];
                        }
                    }

                    CHMGC.RESULT_QUERY res = CLIENT_APP_PARAM.gcws.INSERT_FACTURE_CLIENT(DATE_FACTURE.Value, CODE_CLIENT.ToString(), HT.Value, TVA.Value, TTC.Value, TAUX_REMISE.Value, TTC.Value, TIMBRE.Value, NP.Value, ML.Text, false, "Non reglée", credit, CODE_MAG, Convert.ToDecimal(CLIENT_APP_PARAM.Fenetre_principale.code_user), CLIENT_APP_PARAM.Fenetre_principale.prenom_user, CLIENT_APP_PARAM.Fenetre_principale.nom_user, REMARQUE, dtDetailsFc, bl);
                    if (res.OK)
                    {
                        CODE_FACTURE.Text = res.CODE;
                        MessageBox.Show(res.MESSAGE, "Enregistrement de facture.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        chM_CMP_VALIDATION1.button1.Enabled = false;

                        if (MessageBox.Show("Voulez vous imprimer la facture?", "Impression", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                        {
                            try
                            {
                                this.Cursor = Cursors.WaitCursor;
                                ReportDocument rpt = new CHM_RPT_FACTURE();
                                rpt.SetDataSource(CLIENT_APP_PARAM.gcws.Imprimer_FACTURE_CLIENT(res.CODE));
                                rpt.SetParameterValue("entete", CLIENT_APP_PARAM.entete);
                                rpt.PrintOptions.PrinterName = CLIENT_APP_PARAM.ReportPrinter;
                                rpt.PrintToPrinter(1, true, 0, 0);
                                this.Cursor = Cursors.Default;
                            }
                            catch (Exception print_er)
                            {
                                MessageBox.Show(print_er.Message, "Problème Impression", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            finally
                            {
                                this.Cursor = Cursors.Default;
                            }
                        }
                        if (OnSave != null)
                        {
                            OnSave(res.CODE);
                        }
                        Close();
                    }
                    else
                    {
                        MessageBox.Show(res.MESSAGE, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception er)
                {
                    MessageBox.Show(er.Message, "Connexion serveur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                MessageBox.Show("Rien à facturer!", "Enregistrement facture", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }