示例#1
0
        private void bCustomersList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            wrCustomers.Server2Client sc  = new wrCustomers.Server2Client();
            wrCustomers.wsCustomers   cus = new wrCustomers.wsCustomers();
            sc = cus.getCustomersFull();

            rptCustomers rpt = new rptCustomers()
            {
                DataSource = sc.dataTable
            };

            XRSummary tbal = new XRSummary();

            rpt.lbCNM.DataBindings.Add("Text", null, "CustomerName");
            rpt.lbADR.DataBindings.Add("Text", null, "Address");
            rpt.lbPHN.DataBindings.Add("Text", null, "Phone");
            rpt.lbEML.DataBindings.Add("Text", null, "Email");
            rpt.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
            rpt.lbTBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");

            tbal.FormatString  = "{0:C2}";
            tbal.Running       = SummaryRunning.Report;
            rpt.lbTBAL.Summary = tbal;

            dv.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument(true);
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider1.Validate())
            {
                sc = new wrCustomers.Server2Client();
                wrCustomers.CustomerAccount c = new wrCustomers.CustomerAccount();

                string Remarks = txtRMKS.Text == "" ? "Credit Payment" : txtRMKS.Text;
                c.CustomerID  = Convert.ToInt32(lueCNM.EditValue);
                c.TransDate   = txtPDT.DateTime;
                c.Description = Remarks;
                c.Debit       = 0;
                c.Credit      = Convert.ToDouble(txtAMNT.Text);
                c.Balance     = Convert.ToDouble(txtNBAL.Text);

                cus = new wrCustomers.wsCustomers();
                sc  = cus.addTrans(c);

                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Payment done successfully!");
                    lueCNM.EditValue = null;
                    txtCBAL.Text     = "0";
                    txtAMNT.Text     = "0";
                    txtNBAL.Text     = "0";
                    txtRMKS.Text     = "";
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }
            }
        }
示例#3
0
        private void btnSell_Click(object sender, EventArgs e)
        {
            if (grv.RowCount <= 0)
            {
                XtraMessageBox.Show("Please add some product to sell");
                return;
            }

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

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

            s.InvoiceNo  = txtINV.Text;
            s.SaleDate   = dtpSDT.DateTime;
            s.CustomerID = CusID;
            s.Amount     = Convert.ToDouble(txtAMT.EditValue);
            s.Discount   = Convert.ToDouble(txtDSC.EditValue);
            s.Payment    = Convert.ToDouble(txtPAM.EditValue);
            s.Balance    = Convert.ToDouble(txtBAL.EditValue);

            sls = new wrSales.wsSales();
            sc  = sls.AddSale(s);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }


            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                wrProducts.Server2Client spc = new wrProducts.Server2Client();
                wrProducts.wsProducts    prd = new wrProducts.wsProducts();
                wrSales.Server2Client    ssc = new wrSales.Server2Client();
                wrSales.SaleDetail       sd  = new wrSales.SaleDetail();
                sd.InvoiceNo    = txtINV.Text;
                sd.ProductID    = Convert.ToInt32(grv.GetRowCellValue(i, colPID));
                sd.Quantity     = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                sd.BuyingValue  = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                sd.SellingValue = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                sd.Amount       = sd.Quantity * sd.SellingValue;

                ssc = sls.AddSaleDetails(sd);
                spc = prd.updateQuantity(sd.ProductID, sd.Quantity, "-");
            }

            XtraMessageBox.Show("Product(s) Sold!");
            grd.DataSource = null;
            InitInvoiceNo();
            lueCAT.EditValue             = null;
            luePNM.EditValue             = null;
            lueCAT.Properties.DataSource = null;
            luePNM.Properties.DataSource = null;
            InitCategories();
            InitProducts();
            Reset();
        }
示例#4
0
        private XtraReport rpt()
        {
            sc   = new wrCustomers.Server2Client();
            cust = new wrCustomers.wsCustomers();
            sc   = cust.getCustomersFull();
            Utils u = new Utils();

            rptCustomers rpt = new rptCustomers()
            {
                DataSource = sc.dataTable
            };

            XRSummary tbal = new XRSummary();

            rpt.lbCNM.DataBindings.Add("Text", null, "CustomerName");
            rpt.lbADR.DataBindings.Add("Text", null, "Address");
            rpt.lbPHN.DataBindings.Add("Text", null, "Phone");
            rpt.lbEML.DataBindings.Add("Text", null, "Email");
            rpt.lbBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");
            rpt.lbTBAL.DataBindings.Add("Text", null, "Balance", "{0:C2}");

            tbal.FormatString  = "{0:C2}";
            tbal.Running       = SummaryRunning.Report;
            rpt.lbTBAL.Summary = tbal;
            return(rpt);
        }
示例#5
0
 void InitCustomers()
 {
     wrCustomers.Server2Client scc = new wrCustomers.Server2Client();
     wrCustomers.wsCustomers   cus = new wrCustomers.wsCustomers();
     scc = cus.getCustomers();
     lueCNM.Properties.DataSource    = scc.dataTable;
     lueCNM.Properties.DisplayMember = "CustomerName";
     lueCNM.Properties.ValueMember   = "ID";
 }
示例#6
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);
            }
        }
示例#7
0
        void fillGrid()
        {
            sc   = new wrCustomers.Server2Client();
            cust = new wrCustomers.wsCustomers();

            sc = cust.getCustomers();

            grd.DataSource = sc.dataTable;

            ButtonDisableEnable(sc.Count);
        }
示例#8
0
 public frmSelectCustomer(int ID)
 {
     InitializeComponent();
     sc  = new wrCustomers.Server2Client();
     cus = new wrCustomers.wsCustomers();
     sc  = cus.getCustomers();
     lueCNM.Properties.DataSource    = sc.dataTable;
     lueCNM.Properties.DisplayMember = "CustomerName";
     lueCNM.Properties.ValueMember   = "ID";
     checkEdit1_CheckedChanged(null, null);
     chkSelect.Enabled = false;
 }
示例#9
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);
            }
        }
示例#10
0
        public frmSelectCustomer()
        {
            InitializeComponent();

            sc  = new wrCustomers.Server2Client();
            cus = new wrCustomers.wsCustomers();
            sc  = cus.getCustomers();
            lueCNM.Properties.DataSource    = sc.dataTable;
            lueCNM.Properties.DisplayMember = "CustomerName";
            lueCNM.Properties.ValueMember   = "ID";

            checkEdit1_CheckedChanged(null, null);
            dtFr.DateTime = DateTime.Now.Date;
            dtTo.DateTime = DateTime.Now.Date;
        }
示例#11
0
        public frmCreditPayment()
        {
            InitializeComponent();

            txtPDT.DateTime = DateTime.Now.Date;
            sc  = new wrCustomers.Server2Client();
            cus = new wrCustomers.wsCustomers();
            sc  = cus.getCustomers();

            lueCNM.Properties.DataSource    = sc.dataTable;
            lueCNM.Properties.DisplayMember = "CustomerName";
            lueCNM.Properties.ValueMember   = "ID";

            txtCBAL.Text = "0";
            txtAMNT.Text = "0";
            txtNBAL.Text = "0";
        }
示例#12
0
        private void lueCNM_EditValueChanged(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(lueCNM.EditValue);

            sc  = new wrCustomers.Server2Client();
            cus = new wrCustomers.wsCustomers();
            sc  = cus.getCustomerBalanceByID(id);

            if (sc.Message != null)
            {
                txtCBAL.Text    = sc.Message;
                txtCBAL.Enabled = false;
            }
            else
            {
                txtCBAL.Text = sc.Value.ToString();
            }
        }
示例#13
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";
        }
示例#14
0
        private void bDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show("Are you sure you want to delete this customer?", "Confirm Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int id = Convert.ToInt32(grv.GetFocusedRowCellValue(colID));
                sc   = new wrCustomers.Server2Client();
                cust = new wrCustomers.wsCustomers();
                sc   = cust.deleteCustomer(id);
                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Customer deleted successfully!");
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }

                fillGrid();
                FillGridControl();
            }
        }
示例#15
0
        public ucReports()
        {
            InitializeComponent();

            //if (dv.Document == null)
            //    rpPreview.Visible = false;
            chkALL.Checked     = true;
            checkEdit1.Checked = true;
            wrCustomers.Server2Client csc = new wrCustomers.Server2Client();
            wrCustomers.wsCustomers   cus = new wrCustomers.wsCustomers();
            csc = cus.getCustomers();
            lueCUS.Properties.DataSource    = csc.dataTable;
            lueCUS.Properties.DisplayMember = "CustomerName";
            lueCUS.Properties.ValueMember   = "ID";

            wrSuppliers.Server2Client ssc = new wrSuppliers.Server2Client();
            wrSuppliers.wsSuppliers   sup = new wrSuppliers.wsSuppliers();
            ssc = sup.getSuppliers();
            lueSUP.Properties.DataSource    = ssc.dataTable;
            lueSUP.Properties.DisplayMember = "SupplierName";
            lueSUP.Properties.ValueMember   = "ID";
        }
示例#16
0
        void FillGridControl()
        {
            sc   = new wrCustomers.Server2Client();
            cust = new wrCustomers.wsCustomers();
            sc   = cust.Customer_Account();

            grd.DataSource = sc.dataSet.Tables[0];
            grd.ForceInitialize();
            grd.LevelTree.Nodes.Add(sc.Message, grvD);
            grvD.PopulateColumns(sc.dataSet.Tables[1]);
            grvD.ViewCaption = "Summary";
            grvD.OptionsView.ShowGroupPanel                      = false;
            grvD.Columns["ID"].VisibleIndex                      = -1;
            grvD.Columns["CustomerID"].VisibleIndex              = -1;
            grvD.Columns["TransDate"].OptionsColumn.AllowEdit    = false;
            grvD.Columns["TransDate"].OptionsColumn.AllowFocus   = false;
            grvD.Columns["TransDate"].OptionsColumn.ReadOnly     = true;
            grvD.Columns["Description"].OptionsColumn.AllowEdit  = false;
            grvD.Columns["Description"].OptionsColumn.AllowFocus = false;
            grvD.Columns["Description"].OptionsColumn.ReadOnly   = true;
            grvD.Columns["Debit"].OptionsColumn.AllowEdit        = false;
            grvD.Columns["Debit"].OptionsColumn.AllowFocus       = false;
            grvD.Columns["Debit"].OptionsColumn.ReadOnly         = true;
            grvD.Columns["Debit"].DisplayFormat.FormatType       = FormatType.Numeric;
            grvD.Columns["Debit"].DisplayFormat.FormatString     = "{0:c}";
            grvD.Columns["Credit"].OptionsColumn.AllowEdit       = false;
            grvD.Columns["Credit"].OptionsColumn.AllowFocus      = false;
            grvD.Columns["Credit"].OptionsColumn.ReadOnly        = true;
            grvD.Columns["Credit"].DisplayFormat.FormatType      = FormatType.Numeric;
            grvD.Columns["Credit"].DisplayFormat.FormatString    = "{0:c}";
            grvD.Columns["Balance"].OptionsColumn.AllowEdit      = false;
            grvD.Columns["Balance"].OptionsColumn.AllowFocus     = false;
            grvD.Columns["Balance"].OptionsColumn.ReadOnly       = true;
            grvD.Columns["Balance"].DisplayFormat.FormatType     = FormatType.Numeric;
            grvD.Columns["Balance"].DisplayFormat.FormatString   = "{0:c}";

            ButtonDisableEnable(sc.Count);
        }
示例#17
0
        private void btnSell_Click(object sender, EventArgs e)
        {
            if (lueCNM.EditValue == null)
            {
                XtraMessageBox.Show("Please select Customer!");
                return;
            }
            if (grv.RowCount <= 0)
            {
                XtraMessageBox.Show("Please add some product to sell");
                return;
            }

            wrSales.Sale s = new wrSales.Sale();
            s.InvoiceNo  = txtINV.Text;
            s.SaleDate   = dtpSDT.DateTime;
            s.CustomerID = Convert.ToInt32(lueCNM.EditValue);
            s.Amount     = Convert.ToDouble(txtAMT.EditValue);
            s.Discount   = Convert.ToDouble(txtDSC.EditValue);
            s.Payment    = Convert.ToDouble(txtPAM.EditValue);
            s.Balance    = Convert.ToDouble(txtBAL.EditValue);

            sc  = new wrSales.Server2Client();
            sls = new wrSales.wsSales();

            sc = sls.AddSale(s);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            wrCustomers.Server2Client   scc = new wrCustomers.Server2Client();
            wrCustomers.wsCustomers     cus = new wrCustomers.wsCustomers();
            wrCustomers.CustomerAccount ca  = new wrCustomers.CustomerAccount();

            ca.CustomerID  = Convert.ToInt32(lueCNM.EditValue);
            ca.TransDate   = s.SaleDate;
            ca.Description = s.InvoiceNo;
            if (s.Balance == 0)
            {
                ca.Debit  = s.Payment;
                ca.Credit = s.Payment;
            }
            else
            {
                ca.Debit  = s.Amount - s.Discount;
                ca.Credit = s.Payment;
            }
            ca.Balance = CustomerBalance + s.Balance;
            scc        = cus.addTrans(ca);


            if (scc.Message != null)
            {
                XtraMessageBox.Show(scc.Message);
                return;
            }

            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                wrProducts.Server2Client spc = new wrProducts.Server2Client();
                wrProducts.wsProducts    prd = new wrProducts.wsProducts();
                wrSales.SaleDetail       sd  = new wrSales.SaleDetail();
                sd.InvoiceNo    = txtINV.Text;
                sd.ProductID    = Convert.ToInt32(grv.GetRowCellValue(i, colPID));
                sd.Quantity     = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                sd.BuyingValue  = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                sd.SellingValue = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                sd.Amount       = sd.Quantity * sd.SellingValue;

                sc  = new wrSales.Server2Client();
                sc  = sls.AddSaleDetails(sd);
                spc = prd.updateQuantity(sd.ProductID, sd.Quantity, "-");
            }

            if (XtraMessageBox.Show("Do you want to print receipt?", "Print Receipt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                sc  = new wrSales.Server2Client();
                sls = new wrSales.wsSales();
                sc  = sls.getSoldProductsByInvoiceNo(txtINV.Text);
                rptCashMemo rpt = new rptCashMemo()
                {
                    DataSource = sc.dataTable
                };
                rpt.lblCNM.Text = cc.CustomerName;
                rpt.lblADR.Text = cc.Address;
                rpt.lblPHN.Text = cc.Phone;

                rpt.lblINV.Text = txtINV.Text;
                rpt.lblSDT.Text = dtpSDT.DateTime.ToShortDateString();

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

                if (s.Discount > 0)
                {
                    rpt.xrLabel8.Visible = true;
                    rpt.lblDSC.Text      = "(-) " + s.Discount.ToString("c2");
                }
                else
                {
                    rpt.xrLabel8.Visible = false;
                    rpt.lblDSC.Text      = "";
                }

                rpt.lblTTL.Text = (s.Amount - s.Discount).ToString("c2");
                rpt.lblAMW.Text = "Rupees " + Utils.NumbersToWords(Convert.ToInt32(s.Amount - s.Discount)) + " only";

                rpt.ShowPreviewDialog();
            }
            grd.DataSource = null;
            dt             = new DataTable();
            InitDataTable();
            InitInvoiceNo();
            lueCAT.EditValue             = null;
            luePNM.EditValue             = null;
            lueCAT.Properties.DataSource = null;
            luePNM.Properties.DataSource = null;
            InitCategories();
            InitProducts();
            Reset();
        }
示例#18
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;
             }
         }
     }
 }