Exemple #1
0
        private void InvoiceNo()
        {
            wrSettings.wrSettings stg = new wrSettings.wrSettings();
            string SHN = Properties.Settings.Default.ShortName;

            txtINV.Text = stg.GetServiceInvoiceNo(DateTime.Now.Date, SHN);
        }
Exemple #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!dxValidationProvider1.Validate())
            {
                return;
            }

            //wrCustomers.Server2Client scc = new wrCustomers.Server2Client();
            //wrCustomers.wsCustomers cus = new wrCustomers.wsCustomers();
            //scc = cus.CreateDefaultCustomer();
            //int CusID = scc.Count;

            //wrSales.Server2Client scs = new wrSales.Server2Client();
            //wrSales.wsSales sls = new wrSales.wsSales();
            //wrSales.Sale ss = new wrSales.Sale();

            ////wrSales.Sale s = new wrSales.Sale();

            //ss.InvoiceNo = txtINV.Text;
            //ss.SaleDate = dtpSDT.DateTime;
            //ss.CustomerID = CusID;
            //ss.Amount = Convert.ToDouble(txtAMT.EditValue);
            //ss.Discount =0;
            //ss.Payment = Convert.ToDouble(txtAMT.EditValue);
            //ss.Balance = 0;

            //sls = new wrSales.wsSales();
            //scs = sls.AddSale(ss);
            //if (scs.Message != null)
            //{
            //    XtraMessageBox.Show(scs.Message);
            //    return;
            //}

            s.InvoiceNo   = txtINV.Text;
            s.ServiceDate = dtpSDT.DateTime;
            s.Description = textEdit3.Text;
            s.Amount      = Convert.ToDouble(txtAMT.Text);

            wrSettings.Server2Client sc  = new wrSettings.Server2Client();
            wrSettings.wrSettings    stg = new wrSettings.wrSettings();
            sc  = new wrSettings.Server2Client();
            stg = new wrSettings.wrSettings();

            sc = stg.AddServicing(s);

            if (sc.Message == null)
            {
                XtraMessageBox.Show("Success!");
                Clear();
            }
            else
            {
                XtraMessageBox.Show(sc.Message);
            }
        }
Exemple #3
0
        private void bSoldProducts_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmSelect frm = new frmSelect();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                wrSales.Server2Client sc;
                wrSales.wsSales       s;

                rptSoldProducts       rpt = new rptSoldProducts();
                wrSettings.wrSettings stg = new wrSettings.wrSettings();
                double SVC = 0;

                if (frm.RetVal == 0)
                {
                    sc  = new wrSales.Server2Client();
                    s   = new wrSales.wsSales();
                    sc  = s.getSoldProductsByDate(frm.DateOn);
                    SVC = stg.GetServicingByDate(frm.DateOn);
                    rptProductSold r = new rptProductSold()
                    {
                        DataSource = sc.dataTable
                    };
                    //rpt.DataSource = sc.dataTable;
                    //SELECT Sale.InvoiceNo, Product.ProductName, GROUP_CONCAT(Product.BarCode) BarCode, SaleDetail.SellingValue, Sum(SaleDetail.Quantity) AS SumOfQuantity, Sale.Amount, Sale.Discount, Sale.Payment, Sale.Balance
                    r.lbTTL.Text = "Products sold On " + frm.DateOn.ToShortDateString();
                    XRSummary tam = new XRSummary();
                    XRSummary tdc = new XRSummary();
                    XRSummary tpm = new XRSummary();
                    XRSummary tbl = new XRSummary();
                    XRSummary gam = new XRSummary();
                    XRSummary gdc = new XRSummary();
                    XRSummary gpm = new XRSummary();
                    XRSummary gbl = new XRSummary();

                    //GroupField grp = new GroupField("SaleDate");
                    //GroupField cnm = new GroupField("CustomerName");

                    GroupField sdt = new GroupField("SaleDate");
                    GroupField inv = new GroupField("InvoiceNo");

                    //rpt.GroupHeader1.GroupFields.Add(grp);
                    //rpt.GroupHeader2.GroupFields.Add(cnm);

                    r.grpSDT.GroupFields.Add(sdt);
                    r.grpSDT.GroupFields.Add(inv);
                    //r.sbnINV.Band.

                    r.lbINV.DataBindings.Add("Text", null, "InvoiceNo");
                    r.lbSDT.DataBindings.Add("Text", null, "SaleDate", "{0:dd-MM-yyyy}");
                    r.lbPNM.DataBindings.Add("Text", null, "ProductName");
                    r.lbBCD.DataBindings.Add("Text", null, "BarCode");
                    r.lbSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}");
                    r.lbQTY.DataBindings.Add("Text", null, "SumOfQuantity");
                    r.lbAMT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbDSC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbPAM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
                    r.lbTAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbTDC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbTPM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbTBL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
                    r.lbGAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbGDC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbGPM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbGBL.DataBindings.Add("Text", null, "Balance", "{0:C2}");

                    tam.FormatString = "{0:C2}";
                    tdc.FormatString = "{0:C2}";
                    tpm.FormatString = "{0:C2}";
                    tbl.FormatString = "{0:C2}";
                    gam.FormatString = "{0:C2}";
                    gdc.FormatString = "{0:C2}";
                    gpm.FormatString = "{0:C2}";
                    gbl.FormatString = "{0:C2}";

                    tam.Running = SummaryRunning.Group;
                    tdc.Running = SummaryRunning.Group;
                    tpm.Running = SummaryRunning.Group;
                    tbl.Running = SummaryRunning.Group;
                    gam.Running = SummaryRunning.Report;
                    gdc.Running = SummaryRunning.Report;
                    gpm.Running = SummaryRunning.Report;
                    gbl.Running = SummaryRunning.Report;

                    r.lbTAM.Summary = tam;
                    r.lbTDC.Summary = tdc;
                    r.lbTPM.Summary = tpm;
                    r.lbTBL.Summary = tbl;
                    r.lbGAM.Summary = gam;
                    r.lbGDC.Summary = gdc;
                    r.lbGPM.Summary = gpm;
                    r.lbGBL.Summary = gbl;

                    r.lbSVC.Text = SVC.ToString("C2");

                    dv.PrintingSystem = r.PrintingSystem;
                    r.CreateDocument(true);
                }
                else if (frm.RetVal == 1)
                {
                    sc  = new wrSales.Server2Client();
                    s   = new wrSales.wsSales();
                    sc  = s.getSoldProductsByDates(frm.DateFrom, frm.DateTo);
                    SVC = stg.GetServicingByDates(frm.DateFrom, frm.DateTo);
                    //rpt.DataSource = sc.dataTable;

                    //rpt.lbTTL.Text = "Products sold Between " + frm.DateFrom.ToShortDateString() + " and " + frm.DateTo.ToShortDateString();
                    //XRSummary stt = new XRSummary();
                    //XRSummary gtt = new XRSummary();

                    //GroupField grp = new GroupField("SaleDate");
                    //rpt.GroupHeader1.GroupFields.Add(grp);

                    //rpt.lbSDT.DataBindings.Add("Text", null, "SaleDate", "{0:dd-MM-yyyy}");
                    //rpt.lbPNM.DataBindings.Add("Text", null, "ProductName");
                    //rpt.lbPID.DataBindings.Add("Text", null, "BarCode");
                    //rpt.lbSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}");
                    //rpt.lbQTY.DataBindings.Add("Text", null, "Quantity");
                    //rpt.lbAMT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    //rpt.lbSTT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    //rpt.lbGTT.DataBindings.Add("Text", null, "Amount", "{0:C2}");

                    //stt.FormatString = "{0:C2}";
                    //gtt.FormatString = "{0:C2}";

                    //stt.Running = SummaryRunning.Group;
                    //gtt.Running = SummaryRunning.Report;

                    //rpt.lbSTT.Summary = stt;
                    //rpt.lbGTT.Summary = gtt;

                    //dv.PrintingSystem = rpt.PrintingSystem;
                    //rpt.CreateDocument(true);
                    rptProductSold r = new rptProductSold()
                    {
                        DataSource = sc.dataTable
                    };
                    //rpt.DataSource = sc.dataTable;
                    //SELECT Sale.InvoiceNo, Product.ProductName, GROUP_CONCAT(Product.BarCode) BarCode, SaleDetail.SellingValue, Sum(SaleDetail.Quantity) AS SumOfQuantity, Sale.Amount, Sale.Discount, Sale.Payment, Sale.Balance
                    r.lbTTL.Text = "Products sold On " + frm.DateOn.ToShortDateString();
                    XRSummary tam = new XRSummary();
                    XRSummary tdc = new XRSummary();
                    XRSummary tpm = new XRSummary();
                    XRSummary tbl = new XRSummary();
                    XRSummary gam = new XRSummary();
                    XRSummary gdc = new XRSummary();
                    XRSummary gpm = new XRSummary();
                    XRSummary gbl = new XRSummary();

                    //GroupField grp = new GroupField("SaleDate");
                    //GroupField cnm = new GroupField("CustomerName");

                    GroupField sdt = new GroupField("SaleDate");
                    GroupField inv = new GroupField("InvoiceNo");

                    //rpt.GroupHeader1.GroupFields.Add(grp);
                    //rpt.GroupHeader2.GroupFields.Add(cnm);

                    r.grpSDT.GroupFields.Add(sdt);
                    r.grpSDT.GroupFields.Add(inv);
                    //r.sbnINV.Band.

                    r.lbINV.DataBindings.Add("Text", null, "InvoiceNo");
                    r.lbSDT.DataBindings.Add("Text", null, "SaleDate", "{0:dd-MM-yyyy}");
                    r.lbPNM.DataBindings.Add("Text", null, "ProductName");
                    r.lbBCD.DataBindings.Add("Text", null, "BarCode");
                    r.lbSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}");
                    r.lbQTY.DataBindings.Add("Text", null, "SumOfQuantity");
                    r.lbAMT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbDSC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbPAM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
                    r.lbTAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbTDC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbTPM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbTBL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
                    r.lbGAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
                    r.lbGDC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    r.lbGPM.DataBindings.Add("Text", null, "Payment", "{0:C2}");
                    r.lbGBL.DataBindings.Add("Text", null, "Balance", "{0:C2}");

                    tam.FormatString = "{0:C2}";
                    tdc.FormatString = "{0:C2}";
                    tpm.FormatString = "{0:C2}";
                    tbl.FormatString = "{0:C2}";
                    gam.FormatString = "{0:C2}";
                    gdc.FormatString = "{0:C2}";
                    gpm.FormatString = "{0:C2}";
                    gbl.FormatString = "{0:C2}";

                    tam.Running = SummaryRunning.Group;
                    tdc.Running = SummaryRunning.Group;
                    tpm.Running = SummaryRunning.Group;
                    tbl.Running = SummaryRunning.Group;
                    gam.Running = SummaryRunning.Report;
                    gdc.Running = SummaryRunning.Report;
                    gpm.Running = SummaryRunning.Report;
                    gbl.Running = SummaryRunning.Report;

                    r.lbTAM.Summary   = tam;
                    r.lbTDC.Summary   = tdc;
                    r.lbTPM.Summary   = tpm;
                    r.lbTBL.Summary   = tbl;
                    r.lbGAM.Summary   = gam;
                    r.lbGDC.Summary   = gdc;
                    r.lbGPM.Summary   = gpm;
                    r.lbGBL.Summary   = gbl;
                    r.lbSVC.Text      = SVC.ToString("C2");
                    dv.PrintingSystem = r.PrintingSystem;
                    r.CreateDocument(true);
                }
                else
                {
                    sc = new wrSales.Server2Client();
                    s  = new wrSales.wsSales();
                    //sc = s.getSoldByInvoice(frm.InvoiceNo);
                    sc = s.getSoldProductsByInvoiceNo(frm.InvoiceNo);
                    XRSummary total = new XRSummary();

                    rptCashMemo rpc = new rptCashMemo()
                    {
                        DataSource = sc.dataTable
                    };
                    rpc.lblCNM.DataBindings.Add("Text", null, "CustomerName");
                    rpc.lblADR.DataBindings.Add("Text", null, "Address");
                    rpc.lblPHN.DataBindings.Add("Text", null, "Phone");

                    rpc.lblINV.DataBindings.Add("Text", null, "InvoiceNo");
                    rpc.lblSDT.DataBindings.Add("Text", null, "SaleDate", "{0:dd-MM-yyyy}");

                    rpc.lblPNM.DataBindings.Add("Text", null, "ProductName");
                    rpc.lbSNO.DataBindings.Add("Text", null, "BarCode");
                    rpc.lblQTY.DataBindings.Add("Text", null, "Quantity");
                    rpc.lblPRC.DataBindings.Add("Text", null, "SellingValue", "{0:c}");
                    rpc.lblDSC.DataBindings.Add("Text", null, "Discount", "{0:C2}");
                    rpc.lblAMT.DataBindings.Add("Text", null, "Amount", "{0:c}");
                    rpc.lblTTL.DataBindings.Add("Text", null, "Amount", "{0:c}");

                    total.FormatString = "{0:C2}";
                    total.Running      = SummaryRunning.Report;
                    rpc.lblTTL.Summary = total;
                    //rpt.lblTTL.Text = s.Amount.ToString("c2");
                    double dsc = 0;
                    int    amt = 0;
                    for (int i = 0; i <= sc.dataTable.Rows.Count - 1; i++)
                    {
                        dsc += Convert.ToDouble(sc.dataTable.Rows[i].ItemArray[10]);
                        amt += Convert.ToInt32(sc.dataTable.Rows[i].ItemArray[9]);
                    }
                    if (dsc <= 0)
                    {
                        rpc.xrLabel8.Visible = false;
                        rpc.lblDSC.Visible   = false;
                    }
                    rpc.lblAMW.Text   = "Rupees " + Utils.NumbersToWords(Convert.ToInt32(amt)) + " only";
                    dv.PrintingSystem = rpc.PrintingSystem;
                    rpc.CreateDocument(true);
                }
            }
        }