예제 #1
0
        private void GetBasicParameters()
        {
            INVENTORY.DA.SystemInformation sysinfo = null;
            ReportParameter rParam = new ReportParameter();

            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                sysinfo = (from c in db.SystemInformations
                           where c.SystemInfoID == 1
                           select c).FirstOrDefault();

                if (sysinfo != null)
                {
                    rParam = new ReportParameter("CompanyName", sysinfo.Name);
                    _ReportParameters.Add(rParam);

                    rParam = new ReportParameter("Address", sysinfo.Address);
                    _ReportParameters.Add(rParam);

                    rParam = new ReportParameter("Phone", sysinfo.TelephoneNo);
                    _ReportParameters.Add(rParam);
                }

                rParam = new ReportParameter("Logo", Application.StartupPath + @"\Logo.bmp");
                _ReportParameters.Add(rParam);
            }
        }
        private void fSystemInformation_Load(object sender, EventArgs e)
        {
            try
            {
                btnPhotoClearCus.Enabled = true;
                btnEmpPPClear.Enabled    = true;
                //btnNIDClear.Enabled = true;
                btnSuppClear.Enabled = true;
                //btnSuppDocClear.Enabled = true;
                using (DEWSRMEntities db = new DEWSRMEntities())
                {
                    _SystemInformation = (from c in db.SystemInformations
                                          where c.SystemInfoID == 1
                                          select c).FirstOrDefault();

                    if (_SystemInformation != null)
                    {
                        RefreshValue();
                    }
                    else
                    {
                        _SystemInformation = new DA.SystemInformation();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #3
0
        public void ShowDlg(Product oProduct, bool IsNew)
        {
            _IsNew   = IsNew;
            _Product = oProduct;
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                var _SysInfos = db.SystemInformations;

                _SystemInformation = (from c in db.SystemInformations
                                      where c.SystemInfoID == 1
                                      select c).FirstOrDefault();
            }


            if (!_IsNew)
            {
                cboProType.Enabled = false;
            }

            PopulateUnitTypeCbo();
            PopulateProTypeCbo();
            PopulateTaxCbo();
            RefreshWarrantyType();
            RefreshValue();
            this.ShowDialog();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to save the information?", "Save Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    using (DEWSRMEntities db = new DEWSRMEntities())
                    {
                        if (_SystemInformation.SystemInfoID <= 0)
                        {
                            RefreshObject();
                            _SystemInformation.SystemInfoID = db.SystemInformations.Count() > 0 ? db.SystemInformations.Max(obj => obj.SystemInfoID) + 1 : 1;
                            db.SystemInformations.Add(_SystemInformation);
                        }
                        else
                        {
                            _SystemInformation = db.SystemInformations.FirstOrDefault(obj => obj.SystemInfoID == _SystemInformation.SystemInfoID);
                            RefreshObject();
                        }

                        db.SaveChanges();
                        MessageBox.Show("Data saved successfully.", "Save Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //if (MessageBox.Show("Do you want to create another Customer?", "Create Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //{
                        //    if (ItemChanged != null)
                        //    {
                        //        ItemChanged();
                        //    }
                        //    this.Close();
                        //}
                        //else
                        //{
                        //    if (ItemChanged != null)
                        //    {
                        //        ItemChanged();
                        //    }
                        //    _SystemInformation = new INVENTORY.DA.SystemInformation();
                        //    RefreshValue();

                        //}
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException == null)
                    {
                        MessageBox.Show(ex.Message, "Failed to save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(ex.InnerException.Message, "Failed to save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
예제 #5
0
        public void ShowDlg(Employee oEmployee, bool IsNew)
        {
            _IsNew = IsNew;
            DEWSRMEntities db        = new DEWSRMEntities();
            var            _SysInfos = db.SystemInformations;

            _SystemInformation = (from c in db.SystemInformations
                                  where c.SystemInfoID == 1
                                  select c).FirstOrDefault();

            _Employee = oEmployee;
            PopulateDesignationCbo();
            RefreshValue();
            this.ShowDialog();
        }
예제 #6
0
        public void ShowDlg(Branch oBranch, bool IsNew)
        {
            _IsNew  = IsNew;
            _Branch = oBranch;
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                var _SysInfos = db.SystemInformations;

                _SystemInformation = (from c in db.SystemInformations
                                      where c.SystemInfoID == 1
                                      select c).FirstOrDefault();
            }
            //PopulateCategoryCbo();
            RefreshValue();
            this.ShowDialog();
        }
예제 #7
0
        public void ShowDlg(Supplier oSupplier, bool IsNew)
        {
            _IsNew = IsNew;
            db     = new DEWSRMEntities();
            var _SysInfos = db.SystemInformations;

            _SystemInformation = (from c in db.SystemInformations
                                  where c.SystemInfoID == 1
                                  select c).FirstOrDefault();

            _Supplier = oSupplier;
            RefreshValue();
            if (!_IsNew)
            {
                numOpeningDue.Enabled = false;
                numPrvDue.Enabled     = false;
            }
            this.ShowDialog();
        }
예제 #8
0
        public void ShowDlg(Customer oCustomer, bool IsNew)
        {
            _IsNew    = IsNew;
            _Customer = oCustomer;
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                var _SysInfos = db.SystemInformations;

                _SystemInformation = (from c in db.SystemInformations
                                      where c.SystemInfoID == 1
                                      select c).FirstOrDefault();
            }
            PopulateCusTypeCbo();
            RefreshValue();
            if (!_IsNew)
            {
                numOpeningDue.Enabled = false;
                numPrevDue.Enabled    = false;
            }
            this.ShowDialog();
        }
예제 #9
0
        void pdoc_PrintPage(object sender, PrintPageEventArgs e)
        {
            DEWSRMEntities    db   = new DEWSRMEntities();
            SystemInformation oSys = db.SystemInformations.FirstOrDefault();

            Graphics graphics   = e.Graphics;
            Font     font       = new Font("Courier New", 8);
            float    fontHeight = font.GetHeight();
            int      startX     = 7;
            int      startY     = 20;
            int      Offset     = 30;

            graphics.DrawString("        " + oSys.Name, new Font("Courier New", 9, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;
            graphics.DrawString(oSys.Address, new Font("Courier New", 8, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;

            graphics.DrawString("      " + oSys.TelephoneNo, new Font("Courier New", 8, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;

            String underLine1 = "-------------------------------------------------";

            graphics.DrawString(underLine1, new Font("Courier New", 7), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;

            graphics.DrawString("Cashier Name:" + _CashierName, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;

            graphics.DrawString("Invoice No:" + _InvoiceNo, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 20;
            graphics.DrawString("Date & Time:" + _InvoiceDate, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 15;
            String underLine = "-------------------------------------------------";

            graphics.DrawString(underLine, new Font("Courier New", 7), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset = Offset + 15;                     //-------
            graphics.DrawString("Product " + "     " + "" + " " + " Qty" + "     " + "S.Rate" + "   " + "Total", new Font("Courier New", 8, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset    = Offset + 15;
            underLine = "-------------------------------------------------";
            graphics.DrawString(underLine, new Font("Courier New", 7), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);


            foreach (SOrderDetail oItem in _SOrder.SOrderDetails)
            {
                Offset = Offset + 15;
                graphics.DrawString(oItem.Product.ProductName + "", new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
                Offset = Offset + 15;             //---------------------
                graphics.DrawString("          " + "" + "       " + Math.Round((decimal)oItem.Quantity, 0) + "     " + Math.Round((decimal)oItem.UnitPrice, 2) + "    " + Math.Round((decimal)oItem.UTAmount, 2), new Font("Courier New", 8, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            }

            Offset    = Offset + 15;
            underLine = "-------------------------------------------------";
            graphics.DrawString(underLine, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset = Offset + 15;
            graphics.DrawString("Total Dis.                           " + Math.Round(_TotalDis, 2), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);


            Offset = Offset + 15;
            graphics.DrawString("Net Amount.                          " + Math.Round(_TotalAmt, 2), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            // Offset = Offset + 15;
            //// graphics.DrawString("Prv. Due" + "                            " + Math.Round(_PrvDue,2), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + Offset);

            // Offset = Offset + 15;
            // graphics.DrawString("Grand Total :" + "                       " + Math.Round(_GrandTotal,2), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + Offset);

            Offset    = Offset + 15;
            underLine = "-------------------------------------------------";
            graphics.DrawString(underLine, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);


            Offset = Offset + 15;
            graphics.DrawString("AdjustAmt. :                         " + Math.Round(_Adjust, 2), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset    = Offset + 15;
            underLine = "-------------------------------------------------";
            graphics.DrawString(underLine, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset = Offset + 15;
            graphics.DrawString("Payable Amt :                        " + Math.Ceiling(_Payable), new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);

            Offset    = Offset + 15;
            underLine = "-------------------------------------------------";
            graphics.DrawString(underLine, new Font("Courier New", 7, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
        }