public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptInvoice rpt = new rptInvoice();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + lblpath.Text + "';");
                con.Open();
                string cb = "insert into PlotSell(CUSTOMERID,CUSTOMERNAME,PLOTNO,SURVEYNO,PLOTSIZE,RATE,TOTALAMOUNT,BOOKINGAMOUNT,AGREEMENTAMOUNT,TOTALPAIDAMOUNT,BALANCEAMOUNT,EXTRADETAIL,PLOTSELLDATE) VALUES (" + ",'" + cmbCustomer.Text + "','" + txtplotno.Text + "','" + txtsurveyno.Text + "'," + txtplotsize.Text + "," + txtrate.Text + "," + txttotalamount.Text + "," + txtbookingamout.Text + "," + txtagreementamount.Text + "," + txttotalpaidamount.Text + "," + txtbalanceamount.Text + ",'" + txtextradetail.Text + "','" + dtpDate.Text + "')";
                cmd            = new OleDbCommand(cb);
                cmd.Connection = con;
                cmd.ExecuteReader();
                con.Close();
                MessageBox.Show("Successfully saved", "PLOT SELL DETAIL", MessageBoxButtons.OK, MessageBoxIcon.Information);

                con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + lblpath.Text + "';");
                con.Open();
                string cb1 = "insert into Ledger(PLOTSELLID,VOUCHERDATE,VOUCHERTYPE,VOUCHERNO,DEBIT,BAL) VALUES (" + ",'" + dtpDate.Text + "','" + "TOTAL PLOT SELL AMOUNT" + "'," + "," + txttotalamount.Text + "," + txttotalamount.Text + ")";

                cmd            = new OleDbCommand(cb1);
                cmd.Connection = con;
                cmd.ExecuteReader();
                con.Close();

                string a = Convert.ToString(Convert.ToInt64(txttotalamount.Text) - Convert.ToInt64(txtbookingamout.Text));
                con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + lblpath.Text + "';");
                con.Open();
                string cb2 = "insert into Ledger(PLOTSELLID,VOUCHERDATE,VOUCHERTYPE,VOUCHERNO,CREDIT,BAL) VALUES (" + ",'" + dtpDate.Text + "','" + "Booking AMOUNT" + "'," + "," + txtbookingamout.Text + "," + a.ToString() + ")";

                cmd            = new OleDbCommand(cb2);
                cmd.Connection = con;
                cmd.ExecuteReader();
                con.Close();

                a   = Convert.ToString(Convert.ToInt64(a) - Convert.ToInt64(txtagreementamount.Text));
                con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + lblpath.Text + "';");
                con.Open();
                string cb3 = "insert into Ledger(PLOTSELLID,VOUCHERDATE,VOUCHERTYPE,VOUCHERNO,CREDIT,BAL) VALUES (" + ",'" + dtpDate.Text + "','" + "AGREEMENT AMOUNT" + "'," + "," + txtagreementamount.Text + "," + a.ToString() + ")";

                cmd            = new OleDbCommand(cb3);
                cmd.Connection = con;
                cmd.ExecuteReader();
                con.Close();

                DialogResult result1 = MessageBox.Show("Do you want to print this plot sell detail?", "Account Management",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result1 == DialogResult.Yes)
                {
                    try
                    {
                        rptInvoice rpt = new rptInvoice();

                        cmd = new OleDbCommand();
                        OleDbDataAdapter myDA = new OleDbDataAdapter();
                        DataSet          myDS = new DataSet();

                        con            = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + lblpath.Text + "';");
                        cmd.Connection = con;

                        cmd.CommandText    = "SELECT PlotSell.CUSTOMERID,PlotSell.CUSTOMERNAME,PlotSell.PLOTNO,PlotSell.SURVEYNO,PlotSell.PLOTSIZE,PlotSell.RATE,PlotSell.TOTALAMOUNT,PlotSell.BOOKINGAMOUNT,PlotSell.AGREEMENTAMOUNT,PlotSell.TOTALPAIDAMOUNT,PlotSell.BALANCEAMOUNT,PlotSell.EXTRADETAIL,PlotSell.PLOTSELLDATE,PlotSell.PLOTSELLID FROM  PlotSell   WHERE  PlotSell.PLOTSELLID =" + "";
                        cmd.CommandType    = CommandType.Text;
                        myDA.SelectCommand = cmd;
                        myDA.Fill(myDS, "PlotSell");


                        cmd.CommandText    = "SELECT Company.COMPANYNAME,Company.ADDRESS,Company.PHONENO,Company.EMAIL,Company.WEB,Company.TINNO,Company.CSTNO,Company.EXTRA1,Company.EXTRA2 FROM Company ";
                        cmd.CommandType    = CommandType.Text;
                        myDA.SelectCommand = cmd;
                        myDA.Fill(myDS, "Company");

                        cmd.CommandText    = "SELECT Installment.INSTALLMENTNO,Installment.INSTALLMENTDATE,Installment.INSTALLMENT FROM Installment WHERE  Installment.PLOTSELLID =" + " ";
                        cmd.CommandType    = CommandType.Text;
                        myDA.SelectCommand = cmd;
                        myDA.Fill(myDS, "Installment");
                        con.Close();
                        rpt.SetDataSource(myDS);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                btn_save.Enabled = false;
                Reset();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }