Esempio n. 1
0
        public void AddItemToInvoiceItemList(int productID)
        {
            if (Toolbar.IsNullOrNoneAction() || productID <= 0)
            {
                return;
            }

            ICProductsController objProductsController = new ICProductsController();
            ICProductsInfo       objProductsInfo       = objProductsController.GetObjectByID(productID) as ICProductsInfo;

            if (objProductsInfo == null)
            {
                return;
            }

            InvoiceEntities entity = CurrentModuleEntity as InvoiceEntities;

            entity.InvoiceItemList.Add(
                new ARInvoiceItemsInfo()
            {
                FK_ICProductID                = objProductsInfo.ICProductID,
                FK_ICMeasureUnitID            = objProductsInfo.FK_ICProductBasicUnitID,
                ARInvoiceItemProductNo        = objProductsInfo.ICProductNo,
                ARInvoiceItemProductName      = objProductsInfo.ICProductName,
                ARInvoiceItemProductDesc      = objProductsInfo.ICProductDesc,
                ARInvoiceItemProductType      = objProductsInfo.ICProductType,
                ARInvoiceItemProductUnitPrice = objProductsInfo.ICProductPrice
            });
            entity.InvoiceItemList.GridControl.RefreshDataSource();
        }
Esempio n. 2
0
        public void SetDefaultInvoiceName()
        {
            InvoiceEntities entity     = (InvoiceEntities)CurrentModuleEntity;
            ARInvoicesInfo  mainObject = (ARInvoicesInfo)entity.MainObject;

            if (!String.IsNullOrWhiteSpace(mainObject.ARInvoiceName))
            {
                return;
            }

            if (mainObject.FK_ARCustomerID == 0)
            {
                return;
            }

            if (mainObject.FK_ARSaleOrderID == 0)
            {
                return;
            }

            ARSaleOrdersController objSaleOrdersController = new ARSaleOrdersController();
            ARSaleOrdersInfo       objSaleOrdersInfo       = objSaleOrdersController.GetObjectByID(mainObject.FK_ARSaleOrderID) as ARSaleOrdersInfo;

            if (objSaleOrdersInfo == null)
            {
                return;
            }

            mainObject.ARInvoiceName = string.Format("Hóa đơn bán hàng của {0} cho đơn bán hàng {1}", mainObject.ARInvoiceCustomerName, objSaleOrdersInfo.ARSaleOrderNo);
        }
Esempio n. 3
0
 public InvoiceModule()
 {
     this.CurrentModuleName     = "Invoice";
     CurrentModuleEntity        = new InvoiceEntities();
     CurrentModuleEntity.Module = this;
     InitializeModule();
 }
Esempio n. 4
0
        public void ChangeCustomer(int customerID)
        {
            if (Toolbar.IsNullOrNoneAction() || customerID <= 0)
            {
                return;
            }

            InvoiceEntities       entity                 = (InvoiceEntities)CurrentModuleEntity;
            ARInvoicesInfo        mainObject             = (ARInvoicesInfo)CurrentModuleEntity.MainObject;
            ARCustomersController objCustomersController = new ARCustomersController();
            ARCustomersInfo       objCustomersInfo       = objCustomersController.GetObjectByID(customerID) as ARCustomersInfo;

            if (objCustomersInfo == null)
            {
                return;
            }
            if (objCustomersInfo.ARCustomerActiveCheck == false)
            {
                MessageBox.Show("Khách hàng này đã bỏ hoạt động!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            mainObject.FK_ARCustomerID                  = customerID;
            mainObject.ARInvoiceCustomerName            = objCustomersInfo.ARCustomerName;
            mainObject.ARInvoiceCustomerPhone           = string.IsNullOrEmpty(objCustomersInfo.ARCustomerContactPhone1) ? (string.IsNullOrEmpty(objCustomersInfo.ARCustomerContactPhone2) ? string.Empty : objCustomersInfo.ARCustomerContactPhone2) : objCustomersInfo.ARCustomerContactPhone1;
            mainObject.FK_GECurrencyID                  = objCustomersInfo.FK_GECurrencyID;
            mainObject.ARInvoiceCustomerTaxCode         = objCustomersInfo.ARCustomerTaxNumber;
            mainObject.ARInvoiceCustomerAddress         = objCustomersInfo.ARCustomerContactAddress;
            mainObject.ARInvoiceCustomerDeliveryName    = objCustomersInfo.ARCustomerName;
            mainObject.ARInvoiceCustomerDeliveryPhone   = mainObject.ARInvoiceCustomerPhone;
            mainObject.ARInvoiceCustomerDeliveryAddress = mainObject.ARInvoiceCustomerAddress;
            entity.UpdateMainObjectBindingSource();
        }
Esempio n. 5
0
        public override void InitGridControlDataSource()
        {
            InvoiceEntities entity = (InvoiceEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity;
            BindingSource   bds    = new BindingSource();

            bds.DataSource  = entity.InvoiceItemList;
            this.DataSource = bds;
        }
Esempio n. 6
0
        public void DeleteItemFromInvoiceItemList()
        {
            if (Toolbar.IsNullOrNoneAction())
            {
                return;
            }
            InvoiceEntities entity = (InvoiceEntities)CurrentModuleEntity;

            entity.InvoiceItemList.RemoveSelectedRowObjectFromList();
        }
Esempio n. 7
0
        public void UpdateTotalAmount()
        {
            if (Toolbar.IsNullOrNoneAction())
            {
                return;
            }

            InvoiceEntities entity = (InvoiceEntities)CurrentModuleEntity;

            entity.UpdateTotalAmount();
        }
Esempio n. 8
0
        public override void InvalidateToolbar()
        {
            InvoiceEntities entity     = (InvoiceEntities)CurrentModuleEntity;
            ARInvoicesInfo  mainObject = (ARInvoicesInfo)entity.MainObject;

            ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, true);
            if (mainObject.ARInvoiceID > 0)
            {
                ParentScreen.SetEnableOfToolbarButton(BaseToolbar.ToolbarButtonEdit, false);
            }
            base.InvalidateToolbar();
        }
Esempio n. 9
0
        public void ChangeTaxAmount()
        {
            if (Toolbar.IsNullOrNoneAction())
            {
                return;
            }

            InvoiceEntities entity     = (InvoiceEntities)CurrentModuleEntity;
            ARInvoicesInfo  mainObject = (ARInvoicesInfo)entity.MainObject;

            if (mainObject.ARInvoiceSubTotalAmount > 0)
            {
                mainObject.ARInvoiceDiscountPercent = mainObject.ARInvoiceTaxAmount / mainObject.ARInvoiceSubTotalAmount * 100;
            }
            UpdateTotalAmount();
        }
Esempio n. 10
0
        public void ActionNewFromSaleOrederShipment()
        {
            base.ActionNew();
            InvoiceEntities entity     = CurrentModuleEntity as InvoiceEntities;
            ARInvoicesInfo  mainObject = entity.MainObject as ARInvoicesInfo;

            ICShipmentItemsController  objShipmentItemsController = new ICShipmentItemsController();
            List <ICShipmentItemsInfo> shipmentItems = objShipmentItemsController.GetShipmentItemForInvoice();

            guiChooseShipmentItem guiFind = new guiChooseShipmentItem(shipmentItems);

            guiFind.Module = this;
            DialogResult rs = guiFind.ShowDialog();

            if (rs != DialogResult.OK)
            {
                ActionCancel();
                return;
            }
            shipmentItems = guiFind.SelectedObjects as List <ICShipmentItemsInfo>;

            ICShipmentItemsInfo    objShipmentItemsInfo    = shipmentItems.FirstOrDefault();
            ARSaleOrdersController objSaleOrdersController = new ARSaleOrdersController();
            ARSaleOrdersInfo       objSaleOrdersInfo       = objSaleOrdersController.GetObjectByID(objShipmentItemsInfo.FK_ARSaleOrderID) as ARSaleOrdersInfo;

            mainObject.FK_ARSaleOrderID                 = objSaleOrdersInfo.ARSaleOrderID;
            mainObject.ARInvoiceCustomerAddress         = objSaleOrdersInfo.ARSaleOrderCustomerAddress;
            mainObject.ARInvoiceCustomerDeliveryAddress = objSaleOrdersInfo.ARSaleOrderCustomerDeliveryAddress;
            mainObject.ARInvoiceCustomerDeliveryName    = objSaleOrdersInfo.ARSaleOrderCustomerDeliveryName;
            mainObject.ARInvoiceCustomerDeliveryPhone   = objSaleOrdersInfo.ARSaleOrderCustomerDeliveryPhone;
            mainObject.ARInvoiceCustomerName            = objSaleOrdersInfo.ARSaleOrderCustomerName;
            mainObject.ARInvoiceCustomerPhone           = objSaleOrdersInfo.ARSaleOrderCustomerPhone;
            mainObject.ARInvoiceCustomerTaxCode         = objSaleOrdersInfo.ARSaleOrderCustomerTaxCode;
            mainObject.ARInvoiceDiscountPercent         = objSaleOrdersInfo.ARSaleOrderDiscountPercent;
            mainObject.ARInvoiceTaxPercent              = objSaleOrdersInfo.ARSaleOrderTaxPercent;
            mainObject.ARInvoiceExchangeRate            = objSaleOrdersInfo.ARSaleOrderExchangeRate;
            mainObject.ARInvoiceDeliveryDate            = objSaleOrdersInfo.ARSaleOrderDeliveryDate;
            mainObject.ARInvoiceInternalComment         = objSaleOrdersInfo.ARSaleOrderInternalComment;
            mainObject.ARInvoiceComment                 = objSaleOrdersInfo.ARSaleOrderComment;
            mainObject.FK_GECurrencyID       = objSaleOrdersInfo.FK_GECurrencyID;
            mainObject.FK_ARCustomerID       = objSaleOrdersInfo.FK_ARCustomerID;
            mainObject.FK_HRSellerEmployeeID = objSaleOrdersInfo.FK_HRSellerEmployeeID;

            entity.GenerateInvoiceItemList(shipmentItems);
            UpdateTotalAmount();
            entity.UpdateMainObjectBindingSource();
        }
Esempio n. 11
0
        private void InitializeInvoiceReport(ARInvoice report)
        {
            InvoiceEntities entity     = (InvoiceEntities)CurrentModuleEntity;
            ARInvoicesInfo  mainObject = (ARInvoicesInfo)entity.MainObject;

            ARInvoiceItemsController  objInvoiceController = new ARInvoiceItemsController();
            List <ARInvoiceItemsInfo> invoiceItemList      = objInvoiceController.GetInvoiceItemByInvoiceIDForReport(mainObject.ARInvoiceID);

            report.bsARInvoiceItems.DataSource = invoiceItemList;

            XRLabel label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["pnlTitle"].Controls["fld_xrInvoiceDate"];

            if (label != null)
            {
                label.Text = string.Format(label.Text,
                                           mainObject.ARInvoiceDate.Day,
                                           mainObject.ARInvoiceDate.Month,
                                           mainObject.ARInvoiceDate.Year);
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["pnlToDate"].Controls["xr_lblToDate"];
            if (label != null)
            {
                label.Text = string.Format(label.Text,
                                           DateTime.Now.Day,
                                           DateTime.Now.Month,
                                           DateTime.Now.Year);
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["pnlInvoiceNo"].Controls["fld_lblInvoiceNo"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceNo;
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["fld_xrCustomerName"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceCustomerName;
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["xr_lbPhone"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceCustomerPhone;
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["xr_lblCustomerAddress"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceCustomerAddress;
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["xr_lblCustomerDeliveryAddress"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceCustomerDeliveryAddress;
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["fld_lblEmployeeSeller"];
            if (label != null)
            {
                HREmployeesController objEmployeesController = new HREmployeesController();
                label.Text = objEmployeesController.GetObjectNameByID(mainObject.FK_HRSellerEmployeeID);
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["fld_lblDeliveryDate"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceDeliveryDate.ToString("dd/MM/yyyy");
            }

            label = (XRLabel)report.Bands[BandKind.ReportHeader].Controls["fld_InvoiceDesc"];
            if (label != null)
            {
                label.Text = mainObject.ARInvoiceDesc;
            }
        }