Exemple #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            EventJual rpt = new EventJual();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemple #2
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            MySqlTransaction trans = MainForm.c.BeginTransaction();

            try
            {
                MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.Transaction        = trans;
                MainForm.adapterMgr.EVENT_PENJUALAN_DETAILTableAdapter.Transaction = trans;
                if (eprow == null)
                {
                    eprow = dataep.NewEVENT_PENJUALANRow();
                }
                eprow.EVENT_ID           = Convert.ToInt64(cbEvent.SelectedValue.ToString());
                eprow.TOTAL              = Convert.ToDecimal(data.Compute("SUM(SUBTOTAL)", ""));
                eprow.EVENT_PENJUALAN_ID = MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.autogen().ToString();
                eprow.USER_ID            = MainForm.peg.USER_ID;
                eprow.PELANGGAN_ID       = cbCustomer.SelectedValue.ToString();
                dataep.AddEVENT_PENJUALANRow(eprow);
                MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.Update(dataep);
                //trans.Commit();
                foreach (FSRESTAURANT.EVENT_PENJUALAN_DETAILRow item in data)
                {
                    item.EVENT_PENJUALAN_ID = eprow.EVENT_PENJUALAN_ID;
                }

                MainForm.adapterMgr.EVENT_PENJUALAN_DETAILTableAdapter.Update(data);
                MessageBox.Show("insert sukses");
                trans.Commit();
                syncToDatabase();
                Event.Report.EventJual p  = new Report.EventJual();
                Report.PrintPreview    pp = new Report.PrintPreview(p, MainForm.FS);
                pp.setParam("PENJUALAN_ID", eprow.EVENT_PENJUALAN_ID);
                pp.setReport();
                pp.ShowDialog();
                reverseState();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                dataep.Clear();
                MessageBox.Show(ex.Message);
            }
            finally
            {
                trans.Dispose();
            }
        }