Exemplo n.º 1
0
        private void bCreditPayment_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmSelectCustomer frm = new frmSelectCustomer();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                wrCustomers.Server2Client sc  = new wrCustomers.Server2Client();
                wrCustomers.wsCustomers   cus = new wrCustomers.wsCustomers();
                wrCustomers.Customer      c   = new wrCustomers.Customer();

                double bal = 0;
                c = cus.getCustomer(frm.CustomerID);
                rptCreditPayment rpt = new rptCreditPayment();

                XRSummary tdr = new XRSummary();
                XRSummary tcr = new XRSummary();

                rpt.lbCNM.Text = c.CustomerName;
                rpt.lbADR.Text = c.Address;
                rpt.lbPHN.Text = c.Phone;
                rpt.lbEML.Text = c.Email;

                if (!frm.DateSelected)
                {
                    sc             = cus.getCustomerBalanceByID(frm.CustomerID);
                    bal            = sc.Value;
                    sc             = cus.getTransactionDetails(frm.CustomerID);
                    rpt.DataSource = sc.dataTable;
                }
                else
                {
                    sc  = cus.getCustomerBalanceByDates(frm.CustomerID, frm.DateFrom, frm.DateTo);
                    bal = sc.Value;
                    //DataTable dt = cus.AccountStatement(frm.CustomerID, frm.DateFrom, frm.DateTo).dataTable;
                    sc             = cus.AccountStatement(frm.CustomerID, frm.DateFrom, frm.DateTo);
                    rpt.DataSource = sc.dataTable;
                }
                rpt.lbTDT.DataBindings.Add("Text", null, "TransDate", "{0:dd-MM-yyyy}");
                rpt.lbRMK.DataBindings.Add("Text", null, "Description");
                rpt.lbTDR.DataBindings.Add("Text", null, "Debit", "{0:c}");
                rpt.lbTCR.DataBindings.Add("Text", null, "Credit", "{0:c}");
                rpt.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:c}");
                rpt.lblTDR.DataBindings.Add("Text", null, "Debit", "{0:C2}");
                rpt.lblTCR.DataBindings.Add("Text", null, "Credit", "{0:C2}");
                rpt.lblTBL.Text    = bal.ToString("c2");
                tdr.FormatString   = "{0:C2}";
                tcr.FormatString   = "{0:C2}";
                tdr.Running        = SummaryRunning.Report;
                tcr.Running        = SummaryRunning.Report;
                rpt.lblTCR.Summary = tdr;
                rpt.lblTDR.Summary = tcr;

                dv.PrintingSystem = rpt.PrintingSystem;
                rpt.CreateDocument(true);
            }
        }
Exemplo n.º 2
0
        private void lueCNM_EditValueChanged(object sender, EventArgs e)
        {
            if (lueCNM.EditValue != null)
            {
                int CID = Convert.ToInt32(lueCNM.EditValue);
                wrCustomers.Server2Client scc = new wrCustomers.Server2Client();
                wrCustomers.wsCustomers   cus = new wrCustomers.wsCustomers();


                scc             = cus.getCustomerBalanceByID(CID);
                CustomerBalance = scc.Value;

                cc = cus.getCustomer(CID);
            }
        }
Exemplo n.º 3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int CID = Convert.ToInt32(lueCUS.EditValue);

            wrSales.Server2Client sc  = new wrSales.Server2Client();
            wrSales.wsSales       s   = new wrSales.wsSales();
            rptCustomerSales      rpt = new rptCustomerSales();

            if (chkALL.Checked)
            {
                sc             = s.SalesToCustomerByID(CID);
                rpt.DataSource = sc.dataTable;
                rpt.lbTTL.Text = "Product(s) sold to Customer";
            }
            else
            {
                sc             = s.SalesToCustomerByDates(CID, dtpFR.DateTime, dtpTO.DateTime);
                rpt.DataSource = sc.dataTable;
                rpt.lbTTL.Text = "Product(s) sold to Customer between " + dtpFR.DateTime.ToShortDateString() + " and " + dtpTO.DateTime.ToShortDateString();
            }

            GroupField grp = new GroupField("SaleDate");

            rpt.GroupHeader1.GroupFields.Add(grp);

            wrCustomers.wsCustomers cus = new wrCustomers.wsCustomers();
            wrCustomers.Customer    c   = new wrCustomers.Customer();
            c = cus.getCustomer(CID);

            rpt.lbCNM.Text = c.CustomerName;
            rpt.lbADR.Text = c.Address;
            rpt.lbPHN.Text = c.Phone;
            rpt.lbSDT.DataBindings.Add("Text", null, "SaleDate", "{0:dd-MM-yyyy}");
            rpt.lbPNM.DataBindings.Add("Text", null, "ProductName");
            rpt.lbSNO.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}");

            dv.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument(true);

            popCustomer.HidePopup();
        }
Exemplo n.º 4
0
        public frmCustomer(int ID)
        {
            InitializeComponent();
            lbMSG.Text   = string.Empty;
            tmr.Interval = 1000;
            tmr.Tick    += new EventHandler(this.tmr_tick);

            sc  = new wrCustomers.Server2Client();
            cus = new wrCustomers.wsCustomers();
            c   = new wrCustomers.Customer();

            c           = cus.getCustomer(ID);
            _id         = ID;
            txtCNM.Text = c.CustomerName;
            txtADR.Text = c.Address;
            txtPHN.Text = c.Phone;
            txtEML.Text = c.Email;
            //txtBAL.Text = cus.Balance.ToString();

            btnSave.Text = "&Update";
        }
Exemplo n.º 5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (btnSave.Text == "&Update")
     {
         if (dxVP.Validate())
         {
             sc             = new wrCustomers.Server2Client();
             cus            = new wrCustomers.wsCustomers();
             c              = new wrCustomers.Customer();
             c.CustomerID   = _id;
             c.CustomerName = txtCNM.Text;
             c.Address      = txtADR.Text;
             c.Phone        = txtPHN.Text;
             c.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc = cus.updateCustomer(c);
             if (sc.Message == null)
             {
                 lbMSG.Text = "Customer details updated!";
                 Close();
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
         }
     }
     else if (btnSave.Text == "&Save")
     {
         if (dxVP.Validate())
         {
             sc             = new wrCustomers.Server2Client();
             cus            = new wrCustomers.wsCustomers();
             c              = new wrCustomers.Customer();
             c.CustomerName = txtCNM.Text;
             c.Address      = txtADR.Text;
             c.Phone        = txtPHN.Text;
             c.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc = cus.addCustomer(c);
             if (sc.Message == null)
             {
                 lbMSG.Text = "New Customer added!";
                 reset();
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
             tmr.Enabled = true;
             tmr.Start();
         }
     }
     else
     {
         if (dxVP.Validate())
         {
             sc             = new wrCustomers.Server2Client();
             cus            = new wrCustomers.wsCustomers();
             c              = new wrCustomers.Customer();
             c.CustomerName = txtCNM.Text;
             c.Address      = txtADR.Text;
             c.Phone        = txtPHN.Text;
             c.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc  = cus.addCustomer(c);
             _id = sc.Count;
             if (sc.Message == null)
             {
                 //sc = new wrCustomers.Server2Client();
                 //cus = new wrCustomers.wsCustomers();
                 //sc = cus.getMaxID();
                 DialogResult = DialogResult.OK;
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
         }
     }
 }