示例#1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateTo = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();


                vDateTo = dt_Till.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();



                //DataTable dt = objDAL.getPartyLedger(vPartyID, dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString(), dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString());
                DataTable dt = objDAL.getPartiesRecPay(vDateTo.ToShortDateString(), false);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowRecPay(vDateTo, false, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#2
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                if (optRange.Checked == true)
                {
                    vDateFrom = dt_From.Value;   //dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString();
                    vDateTo   = dt_ToDate.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();
                }

                DataTable dt = objDAL.getCashBook(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowCashBook(vDateFrom, vDateTo, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#3
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vWhere = " AND LastPurchase.CustomerID=" + this.txtVendorID.Text;
                }

                decimal vDaysExc;
                decimal.TryParse(txtDaysExc.Text, out vDaysExc);

                vWhere += " and DATEDIFF(day, LastPurchase.LastPurchaseDate, GETDATE())>= " + vDaysExc;


                DataTable dt = objDAL.getPartiesAging(vWhere, Int64.Parse(cboSalesman.SelectedValue.ToString()));
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.PartyAging(dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#4
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (vOpenMode == false)
                {
                    return;
                }
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                vWhere = "AND Sale.SaleID=" + this.txt_InvNo.Text;

                DAL.Reports Msc = new DAL.Reports();
                Msc.connectionstring = objDAL.connectionstring;


                DataTable dt = Msc.getSaleInvoices(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowReport("SALE INVOICES", dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#5
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                //if (optRange.Checked == true)
                //{
                //    vDateFrom = dt_From.Value; //dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString();
                //    vDateTo = dt_ToDate.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();
                //}

                vDateTo = dt_ToDate.Value;

                DataTable dt = objDAL.getTrialBalance(vDateTo.ToShortDateString());


                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                DAL.Misc dal = new DAL.Misc();
                dal.connectionstring = objDAL.connectionstring;

                decimal vNetSaleVal = dal.getNetSalesValue(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                decimal vNetPurVal  = dal.getNetPurchaseValue(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());

                DataRow dr = dt.NewRow();
                dr["AccountType"]  = "EXPENSE";
                dr["AccountNo"]    = "300000";
                dr["AccountTitle"] = "Purchases";
                dr["Debit"]        = vNetPurVal;
                dr["Credit"]       = 0;

                dt.Rows.Add(dr);

                DataRow dr1 = dt.NewRow();
                dr1["AccountType"]  = "REVENUE";
                dr1["AccountNo"]    = "400000";
                dr1["AccountTitle"] = "Sales";
                dr1["Debit"]        = 0;
                dr1["Credit"]       = vNetSaleVal;

                dt.Rows.Add(dr1);

                vForm.ShowTrialBalance(vDateTo, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#6
0
        private void PrintVoucher()
        {
            try
            {
                string vWhere                 = string.Empty;
                string vVoucherType           = getVoucherType();
                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                DataTable dt = objDAL.getVouchersData(" AND VoucherHeader.VoucherID=" + txtVoucherNo.Text + " AND VoucherHeader.VoucherType='" + vVoucherType + "'");
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                if (vVoucherType == "JV")
                {
                    vForm.ShowReport("JOURNAL VOUCHER", dt);
                    vForm.ShowDialog();
                }
                else if (vVoucherType == "CRV")
                {
                    DAL.Settings objSet = new DAL.Settings();
                    objSet.connectionstring = objDAL.connectionstring;

                    DataRow dr = dt.NewRow();
                    dr["VoucherNo"]   = dt.Rows[0]["VoucherNo"];
                    dr["VoucherType"] = dt.Rows[0]["VoucherType"];
                    dr["VoucherDate"] = dt.Rows[0]["VoucherDate"];
                    dr["Narration"]   = dt.Rows[0]["Narration"];
                    dr["AccountNo"]   = 100000;
                    dr["AccountName"] = "Cash"; //objSet.GetSettingValue(DAL.Settings.ProSettings.CashAccTitle);

                    decimal vTotalAmount =
                        dt.AsEnumerable().Sum(r => r.Field <Decimal>("Credit"));

                    dr["Debit"] = vTotalAmount.ToString("G29");

                    //dr["Debit"] = dt.Rows[0]["Credit"];
                    dr["Credit"]     = 0;
                    dr["TranStatus"] = "DEBIT";

                    dt.Rows.Add(dr);

                    vForm.ShowReport("CASH RECEIVING VOUCHER", dt);
                    vForm.ShowDialog();
                }
                else if (vVoucherType == "CPV")
                {
                    vForm.ShowReport("CASH PAYMENT VOUCHER", dt);
                    vForm.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#7
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere   = string.Empty;
                string criteria = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                DateTime vFromDate = dt_From.Value;
                DateTime vToDate   = dt_ToDate.Value;

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vWhere = " AND SaleReturn.CustomerID=" + this.txtVendorID.Text;
                }

                if (Int32.Parse(cboSalesman.SelectedValue.ToString()) > 0)
                {
                    vWhere   += " AND SaleReturn.SaleID IN (Select SaleID From Sale Where SalesmanID=" + cboSalesman.SelectedValue.ToString() + ")";
                    criteria += " Salesman: " + cboSalesman.SelectedText;
                }

                //if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                //{
                //    vWhere += " AND SaleRetBody.ProductID=" + this.txt_ProductID.Text;
                //}

                if (optRange.Checked == true)
                {
                    criteria = "From: " + dt_From.Value.ToString("dd-MMM-yyyy") + " To: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }
                else
                {
                    vFromDate = Convert.ToDateTime("1/1/2000");
                    vToDate   = DateTime.Now;
                    criteria  = " Till Date: " + vToDate.ToString("dd-MMM-yyyy");
                }


                DataTable dt = objDAL.getPartyProductWiseSale(txtVendorID.Text, int.Parse(cboSalesman.SelectedValue.ToString()), vFromDate.ToShortDateString(), vToDate.ToShortDateString());
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.PartyProductWiseSale(criteria, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#8
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                {
                    vWhere = " AND Products.ProductID=" + this.txt_ProductID.Text;
                }

                if (chkConsumable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=1";
                }

                if (chkSaleable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=0";
                }

                DataTable dt = objDAL.getProductList(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                int vStyle = 0;

                if (optBothPrices.Checked)
                {
                    vStyle = 0;
                }
                else if (optPurOnly.Checked)
                {
                    vStyle = 1;
                }
                else if (optSaleOnly.Checked)
                {
                    vStyle = 2;
                }

                vForm.ProductList(dt, vStyle);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#9
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere   = string.Empty;
                string criteria = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();


                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vWhere += " AND RecoveryBody.CustomerID=" + this.txtVendorID.Text;
                }

                if (Int32.Parse(cboSalesman.SelectedValue.ToString()) > 0)
                {
                    vWhere += " AND Recovery.SalesmanID=" + cboSalesman.SelectedValue.ToString();
                    //criteria += " Salesman: " + cboSalesman.SelectedText;
                }



                if (optRange.Checked == true)
                {
                    vWhere   += " AND convert(datetime,Convert(varchar,Recovery.RecoveryDate,1)) Between Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_From.Text + " 00:00:00',102),1))) AND Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_ToDate.Text + " 00:00:00',102),1)))";
                    criteria += "From: " + dt_From.Value.ToString("dd-MMM-yyyy") + " To: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }
                else
                {
                    criteria += " Till Date: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }


                DataTable dt = objDAL.getSalesmanRecovery(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.SalesmanRecovery(criteria, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#10
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (vOpenMode == false)
                {
                    return;
                }
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                vWhere = "AND Sale.SaleID=" + this.txtInvNo.Text;

                DAL.Reports Msc = new DAL.Reports();
                Msc.connectionstring = objDAL.connectionstring;


                DataTable dt = Msc.getSaleInvoices(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                int vStyle = 0;

                if (chkLetterPad.Checked)
                {
                    vStyle = 2;
                }

                if (chkInUrdu.Checked)
                {
                    vStyle = 1;
                }



                vForm.SaleInvoicePrint(dt, vStyle);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#11
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string   vWhere    = string.Empty;
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date;

                if (optRange.Checked == true)
                {
                    vDateFrom = dt_From.Value;
                    vDateTo   = dt_ToDate.Value;
                }

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                {
                    vWhere = " AND Products.ProductID=" + this.txt_ProductID.Text;
                }

                if (chkConsumable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=1";
                }

                if (chkSaleable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=0";
                }


                DataTable dt = objDAL.getStockStatement(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString(), vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowStockStatement(dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#12
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string   vPartyID  = string.Empty;
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    MessageBox.Show("Must Select a Party First!!!", "Missing Information");
                    return;
                }

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vPartyID = this.txtVendorID.Text;
                }



                if (optRange.Checked == true)
                {
                    vDateFrom = dt_From.Value;   //dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString();
                    vDateTo   = dt_ToDate.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();
                }


                //DataTable dt = objDAL.getPartyLedger(vPartyID, dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString(), dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString());
                DataTable dt = objDAL.getPartyLedger(vPartyID, vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowLedger(vPartyID, string.Empty, vDateFrom, vDateTo, dt, chkLetterPad.Checked);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#13
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere   = string.Empty;
                string criteria = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                {
                    vWhere += " AND StockWastageBody.ProductID=" + this.txt_ProductID.Text;
                }

                if (optRange.Checked == true)
                {
                    vWhere   += " AND convert(datetime,Convert(varchar,StockWastage.EntryDate,1)) Between Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_From.Text + " 00:00:00',102),1))) AND Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_ToDate.Text + " 00:00:00',102),1)))";
                    criteria += "From: " + dt_From.Value.ToString("dd-MMM-yyyy") + " To: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }
                else
                {
                    criteria += " Till Date: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }


                DataTable dt = objDAL.getRecord(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ProductWiseWaste(criteria, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#14
0
        private void PrintRecord(Int64 vID)
        {
            try
            {
                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                DataTable dt = objDAL.getPrintData(vID);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                vForm.ShareSalesPrint(dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#15
0
        private void PrintVoucher(Int64 vVoucherID)
        {
            try
            {
                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                DataTable dt = objDAL.getPrintData(vVoucherID);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                vForm.ShowReport("BANK PAYMENT VOUCHER", dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#16
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom  = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo    = DateTime.Today.Date;
                string   vNarration = "";

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                if (optRange.Checked == true)
                {
                    vDateFrom  = dt_From.Value;
                    vDateTo    = dt_ToDate.Value;
                    vNarration = "From " + dt_From.Value.ToShortDateString() + " To " + dt_ToDate.Value.ToShortDateString();
                }
                else
                {
                    vNarration = "For the Period Ended " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }

                DataTable dt = objDAL.getProfitAndLoss(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString(), true);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }



                vForm.ShowExenseSheet(vNarration, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#17
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere       = string.Empty;
                string vReportTitle = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();


                DataTable dt = new DataTable();

                if (optBankAcc.Checked)
                {
                    dt           = objDAL.getBankAccList(vWhere);
                    vReportTitle = "BANK ACCOUNT LIST";
                }
                else if (optGeneral.Checked)
                {
                    dt           = objDAL.getAccountsList(vWhere);
                    vReportTitle = "GEN ACCOUNT LIST";
                }



                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                vForm.ShowReport(vReportTitle, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#18
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                {
                    vWhere = " AND Products.ProductID=" + this.txt_ProductID.Text;
                }

                if (chkConsumable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=1";
                }

                if (chkSaleable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=0";
                }


                DataTable dt = objDAL.getCurrentStock(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowReport("CURRENT STOCK", dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#19
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    vWhere = " AND PartyID=" + this.txtVendorID.Text;
                }

                if (chkSupplier.Checked == true)
                {
                    vWhere += " AND Isnull(IsSupplier)=1";
                }

                if (chkCustomer.Checked == true)
                {
                    vWhere += " AND Isnull(IsCustomer)=1";
                }

                DataTable dt = objDAL.getPartiesList(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowReport("PARTIES LIST", dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#20
0
        private void PrintVoucher()
        {
            try
            {
                string vWhere                 = string.Empty;
                string vVoucherType           = getVoucherType();
                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                DataTable dt = objDAL.getVouchersData(" AND VoucherHeader.VoucherID=" + txtVoucherNo.Text + " AND VoucherHeader.VoucherType='" + vVoucherType + "'");
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                if (vVoucherType == "JV")
                {
                    vForm.ShowReport("JOURNAL VOUCHER", dt);
                    vForm.ShowDialog();
                }
                else if (vVoucherType == "CRV")
                {
                    vForm.ShowReport("CASH RECEIVING VOUCHER", dt);
                    vForm.ShowDialog();
                }
                else if (vVoucherType == "CPV")
                {
                    vForm.ShowReport("CASH PAYMENT VOUCHER", dt);
                    vForm.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#21
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere   = string.Empty;
                string criteria = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!chkReturn.Checked)
                {
                    if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                    {
                        vWhere += " AND Sale.CustomerID=" + this.txtVendorID.Text;
                    }

                    if (Int32.Parse(cboSalesman.SelectedValue.ToString()) > 0)
                    {
                        vWhere += " AND Sale.SalesmanID=" + cboSalesman.SelectedValue.ToString();
                        //criteria += " Salesman: " + cboSalesman.SelectedText;
                    }

                    //if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                    //{
                    //    vWhere += " AND SaleBody.ProductID=" + this.txt_ProductID.Text;
                    //}

                    if (optCash.Checked)
                    {
                        vWhere   += " AND (ISNULL(Sale.CashReceived, 0) = Sale.GrossValue - ISNULL(Sale.SpecialDisc, 0) )";
                        criteria += " CASH Sale ";
                    }
                    else if (optCredit.Checked)
                    {
                        vWhere   += " AND (ISNULL(Sale.CashReceived, 0) <> Sale.GrossValue - ISNULL(Sale.SpecialDisc, 0) )";
                        criteria += " CREDIT Sale ";
                    }

                    if (optRange.Checked == true)
                    {
                        vWhere   += " AND convert(datetime,Convert(varchar,Sale.EntryDate,1)) Between Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_From.Text + " 00:00:00',102),1))) AND Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_ToDate.Text + " 00:00:00',102),1)))";
                        criteria += "From: " + dt_From.Value.ToString("dd-MMM-yyyy") + " To: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                    }
                    else
                    {
                        criteria += " Till Date: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                    }


                    DataTable dt = objDAL.getPrtyWiseSale(vWhere);
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("No Data To Display", "No Data");
                        return;
                    }
                    vForm.SalesmanSale(criteria, dt, chkLetterPad.Checked, chkShowSummary.Checked);
                    vForm.ShowDialog();
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                    {
                        vWhere = " AND SaleReturn.CustomerID=" + this.txtVendorID.Text;
                    }

                    if (Int32.Parse(cboSalesman.SelectedValue.ToString()) > 0)
                    {
                        vWhere   += " AND SaleReturn.SaleID IN (Select SaleID From Sale Where SalesmanID=" + cboSalesman.SelectedValue.ToString() + ")";
                        criteria += " Salesman: " + cboSalesman.SelectedText;
                    }

                    //if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                    //{
                    //    vWhere += " AND SaleRetBody.ProductID=" + this.txt_ProductID.Text;
                    //}

                    if (optRange.Checked == true)
                    {
                        vWhere  += " AND convert(datetime,Convert(varchar,SaleReturn.EntryDate,1)) Between Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_From.Text + " 00:00:00',102),1))) AND Convert(Datetime,(convert(varchar,convert(Datetime,'" + this.dt_ToDate.Text + " 00:00:00',102),1)))";
                        criteria = "From: " + dt_From.Value.ToString("dd-MMM-yyyy") + " To: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                    }
                    else
                    {
                        criteria = " Till Date: " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                    }


                    DataTable dt = objDAL.getPrtyWiseSaleRet(vWhere);
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("No Data To Display", "No Data");
                        return;
                    }
                    vForm.PartyWiseSaleRet(criteria, dt, chkLetterPad.Checked);
                    vForm.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }
示例#22
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom  = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo    = DateTime.Today.Date;
                string   vNarration = "";

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                if (optRange.Checked == true)
                {
                    vDateFrom  = dt_From.Value;
                    vDateTo    = dt_ToDate.Value;
                    vNarration = "From " + dt_From.Value.ToShortDateString() + " To " + dt_ToDate.Value.ToShortDateString();
                }
                else
                {
                    vNarration = "For the Period Ended " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }

                DataTable dt = objDAL.getProfitAndLoss(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                //if (dt.Rows.Count == 0)
                //{
                //    MessageBox.Show("No Data To Display", "No Data");
                //    return;
                //}

                DAL.Misc dal = new DAL.Misc();
                dal.connectionstring = objDAL.connectionstring;

                decimal vNetSaleVal = dal.getNetSalesValue(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                decimal vNetPurVal  = dal.getNetPurchaseValue(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                decimal vOpStockVal = dal.getOpeningStockValue(string.Empty);

                DataTable dTemp = objDAL.getCurrentStock(string.Empty);

                decimal vCSValue = 0;

                foreach (DataRow dr in dTemp.Rows)
                {
                    decimal vCurrentStockVal = (decimal)dr["Value"];
                    decimal vNetQty          = (decimal)dr["Qty"];
                    decimal vDeducted        = (decimal)dr["LessQty"];

                    decimal vCSRate = vCurrentStockVal / (vNetQty + vDeducted);
                    vCSValue += (vNetQty * vCSRate);
                }

                //decimal vCurrentStockVal = dTemp.AsEnumerable()
                // .Sum(dr => (decimal)dr["Value"]);
                //decimal vNetQty = dTemp.AsEnumerable()
                // .Sum(dr => (decimal)dr["Qty"]);
                //decimal vDeducted = dTemp.AsEnumerable()
                // .Sum(dr => (decimal)dr["LessQty"]);



                vForm.ShowProfitAndLoss(vNarration, vNetSaleVal, vOpStockVal, vNetPurVal, vCSValue, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }