Example #1
0
        private XtraReport rpt()
        {
            sc  = new wrSuppliers.Server2Client();
            sup = new wrSuppliers.wsSuppliers();
            sc  = sup.getSuppliersFull();
            Utils u = new Utils();

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

            XRSummary tbal = new XRSummary();

            rpt.lbCNM.DataBindings.Add("Text", null, "SupplierName");
            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);
        }
Example #2
0
        private void bSuppliersList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            wrSuppliers.Server2Client sc  = new wrSuppliers.Server2Client();
            wrSuppliers.wsSuppliers   sup = new wrSuppliers.wsSuppliers();
            sc = sup.getSuppliersFull();

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

            XRSummary tbal = new XRSummary();

            rpt.lbCNM.DataBindings.Add("Text", null, "SupplierName");
            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);
        }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider1.Validate())
            {
                sc  = new wrSuppliers.Server2Client();
                sup = new wrSuppliers.wsSuppliers();
                wrSuppliers.SupplierAccount s = new wrSuppliers.SupplierAccount();

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

                sc = sup.addTrans(s);

                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Payment done successfully!");
                    lueSNM.EditValue = null;
                    txtCBAL.Text     = "0";
                    txtAMNT.Text     = "0";
                    txtNBAL.Text     = "0";
                    txtRMKS.Text     = "";
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }
            }
        }
Example #4
0
 void InitSuppliers()
 {
     sc = new wrPurchases.Server2Client();
     wrSuppliers.Server2Client s2c = new wrSuppliers.Server2Client();
     sup = new wrSuppliers.wsSuppliers();
     s2c = sup.getSuppliers();
     lueSUP.Properties.DataSource    = s2c.dataTable;
     lueSUP.Properties.DisplayMember = "SupplierName";
     lueSUP.Properties.ValueMember   = "ID";
 }
Example #5
0
        private void bDebitPayment_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmSelectSupplier frm = new frmSelectSupplier();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                wrSuppliers.Server2Client sc  = new wrSuppliers.Server2Client();
                wrSuppliers.wsSuppliers   sup = new wrSuppliers.wsSuppliers();
                wrSuppliers.Supplier      s   = new wrSuppliers.Supplier();
                double bal = 0;
                s = sup.getSupplier(frm.SupplierID);
                rptDebitPayment rpt = new rptDebitPayment();

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

                rpt.lbSNM.Text = s.SupplierName;
                rpt.lbADR.Text = s.Address;
                rpt.lbPHN.Text = s.Phone;
                rpt.lbEML.Text = s.Email;

                if (!frm.DateSelected)
                {
                    sc             = sup.getSupplierBalanceByID(frm.SupplierID);
                    bal            = sc.Value;
                    sc             = sup.getTransactionDetails(frm.SupplierID);
                    rpt.DataSource = sc.dataTable;
                }
                else
                {
                    sc             = sup.getSupplierBalanceByDates(frm.SupplierID, frm.DateFrom, frm.DateTo);
                    bal            = sc.Value;
                    sc             = sup.AccountStatement(frm.SupplierID, 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);
            }
        }
Example #6
0
        private void fillGrid()
        {
            sup = new wrSuppliers.wsSuppliers();
            sc  = new wrSuppliers.Server2Client();

            sc = sup.getSuppliers();

            grd.DataSource = sc.dataTable;

            ButtonDisableEnable(sc.Count);
        }
Example #7
0
        private void lueSUP_EditValueChanged(object sender, EventArgs e)
        {
            int id = lueSUP.EditValue == null ? 0 : Convert.ToInt32(lueSUP.EditValue);

            wrSuppliers.Server2Client sc  = new wrSuppliers.Server2Client();
            wrSuppliers.wsSuppliers   sa  = new wrSuppliers.wsSuppliers();
            wrSuppliers.Supplier      sup = new wrSuppliers.Supplier();
            //c = cus.getCustomer(id);
            sc = sa.getSupplierBalanceByID(id);
            SupplierBalance = sc.Value;
        }
Example #8
0
        public frmSelectSupplier()
        {
            InitializeComponent();

            wrSuppliers.Server2Client sc = new wrSuppliers.Server2Client();

            wrSuppliers.wsSuppliers sup = new wrSuppliers.wsSuppliers();
            sc = sup.getSuppliers();
            lueSNM.Properties.DataSource    = sc.dataTable;
            lueSNM.Properties.DisplayMember = "SupplierName";
            lueSNM.Properties.ValueMember   = "ID";

            chkSEL_CheckedChanged(null, null);
        }
Example #9
0
        public frmDebitPayment()
        {
            InitializeComponent();
            txtPDT.DateTime = DateTime.Now.Date;
            sc  = new wrSuppliers.Server2Client();
            sup = new wrSuppliers.wsSuppliers();
            sc  = sup.getSuppliersFull();

            lueSNM.Properties.DataSource    = sc.dataTable;
            lueSNM.Properties.DisplayMember = "SupplierName";
            lueSNM.Properties.ValueMember   = "ID";

            txtCBAL.Text = "0";
            txtAMNT.Text = "0";
            txtNBAL.Text = "0";
        }
Example #10
0
        private void lueSNM_EditValueChanged(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(lueSNM.EditValue);

            sc  = new wrSuppliers.Server2Client();
            sup = new wrSuppliers.wsSuppliers();
            sc  = sup.getSupplierBalanceByID(id);

            if (sc.Message != null)
            {
                txtCBAL.Text    = sc.Message;
                txtCBAL.Enabled = false;
            }
            else
            {
                txtCBAL.Text = sc.Value.ToString();
            }
        }
Example #11
0
        public frmDebitPayment(int SupplierID)
        {
            InitializeComponent();
            txtPDT.DateTime = DateTime.Now.Date;
            sc  = new wrSuppliers.Server2Client();
            sup = new wrSuppliers.wsSuppliers();
            sc  = sup.getSuppliers();

            lueSNM.Properties.DataSource    = sc.dataTable;
            lueSNM.Properties.DisplayMember = "SupplierName";
            lueSNM.Properties.ValueMember   = "ID";

            lueSNM.EditValue = SupplierID;
            sc = sup.getSupplierBalanceByID(SupplierID);

            txtCBAL.Text = sc.Value.ToString();

            txtAMNT.Text = "0";
            txtNBAL.Text = "0";
        }
Example #12
0
        private void bDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show("Are you sure you want to delete this Supplier?", "Confirm Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int id = Convert.ToInt32(grv.GetFocusedRowCellValue(colID));
                sc  = new wrSuppliers.Server2Client();
                sup = new wrSuppliers.wsSuppliers();
                sc  = sup.deleteSupplier(id);
                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Supplier deleted successfully!");
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }

                fillGrid();
                FillGridControl();
            }
        }
Example #13
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";
        }
Example #14
0
        public frmSuppliers(int id)
        {
            InitializeComponent();

            lbMSG.Text   = string.Empty;
            tmr.Interval = 1000;
            tmr.Tick    += new EventHandler(this.tmr_tick);

            sc  = new wrSuppliers.Server2Client();
            s   = new wrSuppliers.Supplier();
            sup = new wrSuppliers.wsSuppliers();

            s           = sup.getSupplier(id);
            _id         = id;
            txtCNM.Text = s.SupplierName;
            txtADR.Text = s.Address;
            txtPHN.Text = s.Phone;
            txtEML.Text = s.Email;
            //txtBAL.Text = cus.Balance.ToString();

            btnOK.Text = "&Update";
        }
Example #15
0
        private void FillGridControl()
        {
            sc  = new wrSuppliers.Server2Client();
            sup = new wrSuppliers.wsSuppliers();
            sc  = sup.Supplier_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["SupplierID"].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);
        }
Example #16
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (btnOK.Text == "&Update")
     {
         if (dxvp.Validate())
         {
             sc             = new wrSuppliers.Server2Client();
             s              = new wrSuppliers.Supplier();
             sup            = new wrSuppliers.wsSuppliers();
             s.SupplierID   = _id;
             s.SupplierName = txtCNM.Text;
             s.Address      = txtADR.Text;
             s.Phone        = txtPHN.Text;
             s.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc = sup.updateSupplier(s);
             if (sc.Message == null)
             {
                 lbMSG.Text = "Supplier details updated!";
                 Close();
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
         }
     }
     else if (btnOK.Text == "&Save")
     {
         if (dxvp.Validate())
         {
             sc             = new wrSuppliers.Server2Client();
             s              = new wrSuppliers.Supplier();
             sup            = new wrSuppliers.wsSuppliers();
             s.SupplierName = txtCNM.Text;
             s.Address      = txtADR.Text;
             s.Phone        = txtPHN.Text;
             s.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc = sup.addSupplier(s);
             if (sc.Message == null)
             {
                 lbMSG.Text = "New Supplier added!";
                 reset();
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
             tmr.Enabled = true;
             tmr.Start();
         }
     }
     else
     {
         if (dxvp.Validate())
         {
             sc             = new wrSuppliers.Server2Client();
             s              = new wrSuppliers.Supplier();
             sup            = new wrSuppliers.wsSuppliers();
             s.SupplierName = txtCNM.Text;
             s.Address      = txtADR.Text;
             s.Phone        = txtPHN.Text;
             s.Email        = txtEML.Text;
             //cus.Balance = Convert.ToInt32(txtBAL.Text);
             sc  = sup.addSupplier(s);
             _id = sc.Count;
             if (sc.Message == null)
             {
                 sc  = new wrSuppliers.Server2Client();
                 sup = new wrSuppliers.wsSuppliers();
                 //sc = sup.getMaxID();
                 DialogResult = DialogResult.OK;
             }
             else
             {
                 lbMSG.Text = sc.Message;
             }
         }
     }
 }
Example #17
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            sc  = new wrPurchases.Server2Client();
            pur = new wrPurchases.wsPurchases();
            wrPurchases.Purchase prc = new wrPurchases.Purchase();
            //Products prd = new Products();

            prc.InvoiceNo    = txtINV.Text;
            prc.PurchaseDate = dtpPDT.DateTime;
            prc.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
            prc.Amount       = Convert.ToDouble(txtAMT.EditValue);
            prc.Payment      = Convert.ToDouble(txtPAM.EditValue);
            prc.Balance      = Convert.ToDouble(txtBAL.EditValue);

            sc = pur.addPurchase(prc);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            sup = new wrSuppliers.wsSuppliers();
            wrSuppliers.Server2Client   s2c = new wrSuppliers.Server2Client();
            wrSuppliers.SupplierAccount s   = new wrSuppliers.SupplierAccount();

            s.SupplierID  = Convert.ToInt32(lueSUP.EditValue);
            s.TransDate   = dtpPDT.DateTime;
            s.Description = txtINV.Text;
            s.Debit       = Convert.ToDouble(txtAMT.EditValue);
            s.Credit      = Convert.ToDouble(txtPAM.EditValue);
            s.Balance     = SupplierBalance + Convert.ToDouble(txtBAL.Text);
            s2c           = sup.addTrans(s);
            if (sc.Message != null)
            {
                XtraMessageBox.Show(sc.Message);
                return;
            }

            Guid g;

            for (int i = 0; i <= grv.RowCount - 1; i++)
            {
                int    cid = Convert.ToInt32(grv.GetRowCellValue(i, colCID));
                string pnm = grv.GetRowCellValue(i, colPNM).ToString();
                double bvl = Convert.ToDouble(grv.GetRowCellValue(i, colBVL));
                double svl = Convert.ToDouble(grv.GetRowCellValue(i, colSVL));
                int    qty = Convert.ToInt32(grv.GetRowCellValue(i, colQTY));
                double amt = Convert.ToDouble(grv.GetRowCellValue(i, colAMT));
                string bcd = grv.GetRowCellValue(i, colBCD).ToString();

                wrPurchases.PurchaseDetail pdt = new wrPurchases.PurchaseDetail();
                pdt.InvoiceNo    = txtINV.Text;
                g                = Guid.NewGuid();
                pdt.ProductCode  = g.ToString();
                pdt.BuyingValue  = bvl;
                pdt.SellingValue = svl;
                pdt.Quantity     = qty;
                pdt.Amount       = amt;
                sc               = pur.addPurchaseDetails(pdt);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }

                wrProducts.wsProducts    prd = new wrProducts.wsProducts();
                wrProducts.Product       p   = new wrProducts.Product();
                wrProducts.Server2Client spc = new wrProducts.Server2Client();

                p.CategoryID   = cid;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.ProductCode  = g.ToString();
                p.ProductName  = pnm;
                p.BuyingValue  = bvl;
                p.SellingValue = svl;
                p.SupplierID   = Convert.ToInt32(lueSUP.EditValue);
                p.Quantity     = qty;
                p.BarCode      = bcd;

                spc = prd.AddProduct(p);
                if (sc.Message != null)
                {
                    XtraMessageBox.Show(sc.Message);
                    return;
                }
            }

            XtraMessageBox.Show("Product(s) purchased successfully!");
            InitInvoice();
            dtpPDT.DateTime = DateTime.Now.Date;
            dt = new DataTable();
            InitDataTable();
            InitSuppliers();
            InitCategories();
            grd.DataSource = null;
        }