Esempio n. 1
0
        private void GenerateTmpDemandOrderDTOList(List <TmpDemandOrderDTO> dtoDemandOrderList)
        {
            DateTime dtmSelect = Convert.ToDateTime(dtpDemand.Value);

            for (int iRow = 0; iRow < shtView.Rows.Count; iRow++)
            {
                #region validation
                ValidateException.ThrowErrorItem(
                    PurchaseOrderEntryValidation.CheckEmptyString((NZString)Convert.ToString(shtView.Cells[iRow, (int)eColumn.ITEM_DESC].Value), Messages.eValidate.VLM0129));
                #endregion
                for (int iColumn = (int)eColumn.Day1; iColumn < DateTime.DaysInMonth(dtmSelect.Year, dtmSelect.Month) + (int)eColumn.Day1; iColumn++)
                {
                    TmpDemandOrderDTO dtoTmpDemandOrder = new TmpDemandOrderDTO
                    {
                        CRT_BY      = CommonLib.Common.CurrentUserInfomation.UserCD,
                        CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine,
                        CRT_DATE    = (NZDateTime)DateTime.UtcNow,
                        CUSTOMER_CD = (NZString)txtCusCD.Text,
                        DUE_DATE    = (NZDateTime)(new DateTime(dtmSelect.Year, dtmSelect.Month, (iColumn - 2))),
                        ITEM_CD     = (NZString)Convert.ToString(shtView.Cells[iRow, (int)eColumn.ITEM_CD].Value.ToString()),
                        ITEM_DESC   = (NZString)Convert.ToString(shtView.Cells[iRow, (int)eColumn.ITEM_DESC].Value),
                        ORDER_QTY   = (NZDecimal)(Convert.ToDecimal(shtView.Cells[iRow, iColumn].Value)),
                        ORDER_TYPE  = null,
                        YEAR_MONTH  = (NZDateTime)dtpDemand.Value,
                    };

                    if (dtoTmpDemandOrder.ORDER_QTY > 0)
                    {
                        dtoDemandOrderList.Add(dtoTmpDemandOrder);
                    }
                }
            }
        }
Esempio n. 2
0
        private void DeletePO()
        {
            int iActive = shtView.ActiveRowIndex;
            List <PurchaseOrderDDTO> dDTOPurchaseOrderList = new List <PurchaseOrderDDTO>();

            ValidateException.ThrowErrorItem(
                PurchaseOrderEntryValidation.CheckEmptyString(
                    (NZString)Convert.ToString(shtView.Cells[iActive, (int)eColumn.PO_LINE].Value),
                    Messages.eValidate.VLM0142));

            dDTOPurchaseOrderList.Add(new PurchaseOrderDDTO
            {
                PO_NO = (NZString)Convert.ToString(shtView.Cells[iActive, (int)eColumn.PO_NO].Value),

                PO_LINE = (NZDecimal)Convert.ToDecimal(shtView.Cells[iActive, (int)eColumn.PO_LINE].Value),

                RECEIVE_QTY = (NZDecimal)Convert.ToDecimal(shtView.Cells[iActive, (int)eColumn.RECEIVE_QTY].Value),
                ITEM_CD     = (NZString)Convert.ToString(shtView.Cells[iActive, (int)eColumn.ITEM_CD].Value),
                DUE_DATE    = (NZDateTime)Convert.ToDateTime(shtView.Cells[iActive, (int)eColumn.DUE_DATE].Value)
            });
            new PurchaseOrderBIZ().DeletePOLine(GeneratePurchaseOrderHDTO(), dDTOPurchaseOrderList);

            MessageDialog.ShowInformation(this, "Information", new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription);
            OnRefresh();
        }
Esempio n. 3
0
        /// <summary>
        /// Generate PO Header.
        /// </summary>
        /// <param name="strPONo">PO No of PO Header.</param>
        /// <returns>PO Header</returns>
        private PurchaseOrderHDTO GeneratePurchaseOrderHDTO(NZString strPONo)
        {
            NZDateTime dtmPO         = new NZDateTime(dtmPODate, dtmPODate.Value);
            NZString   strSupplierCD = new NZString(cboSupplierCode, cboSupplierCode.SelectedValue);
            NZString   strDeliveryTo = chkOurFactory.Checked ? new NZString(cboDelivery, cboDelivery.Text) : new NZString(cboDelivery, cboDelivery.SelectedValue);
            NZString   strCurrency   = new NZString(cboCurrency, cboCurrency.SelectedValue);
            NZString   strVatRate    = new NZString(txtVatRate, txtVatRate.Text);
            string     strVatType    = (Convert.ToInt32(strVatRate) > 0) ? "02" : "01";

            #region validation

            ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDateTimeValue(dtmPO, Messages.eValidate.VLM0116));
            ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strSupplierCD, Messages.eValidate.VLM0118));
            if (!chkOurFactory.Checked)
            {
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString((NZString)strDeliveryTo, Messages.eValidate.VLM0119));
            }
            ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString((NZString)strCurrency, Messages.eValidate.VLM0121));
            if (this.m_ScreenStateEnum == eScreenState.Add)
            {
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckPurchaseOrderItem((NZInt)shtView.Rows.Count));
            }

            #endregion


            PurchaseOrderHDTO hDTO = new PurchaseOrderHDTO
            {
                CRT_BY      = CommonLib.Common.CurrentUserInfomation.UserCD,
                CRT_DATE    = (NZDateTime)DateTime.UtcNow,
                CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine,
                UPD_BY      = CommonLib.Common.CurrentUserInfomation.UserCD,
                UPD_DATE    = (NZDateTime)DateTime.UtcNow,
                UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine,

                PO_NO     = strPONo,
                PO_DATE   = (NZDateTime)dtmPO,
                IS_ACTIVE = (NZBoolean)m_bIsActived, //(NZBoolean)((m_iPOStatus == 1) ? true : false),
                PO_TYPE   = (NZString)"01",          //(NZString)(cboPOType.SelectedValue.ToString()),

                IS_EXPORT = (NZBoolean)false,        //(NZBoolean)chkExport.Checked,
                ADDRESS   = (NZString)"",            // (NZString)txtAddress.Text,

                SUPPLIER_CD     = (NZString)strSupplierCD,
                DELIVERY_TO     = (NZString)strDeliveryTo,
                TERM_OF_PAYMENT = (NZString)(Convert.ToString(cboTermOfPayment.SelectedValue)),

                STATUS   = (NZString)"0",
                VAT_TYPE = (NZString)strVatType,
                VAT_RATE = (NZDecimal)Convert.ToDecimal(strVatRate),
                CURRENCY = (NZString)(cboCurrency.SelectedValue.ToString()),

                REMARK = (NZString)txtRemark.Text,
            };

            return(hDTO);
        }
Esempio n. 4
0
        /// <summary>
        /// Validate Value of rows in SpreadSheet.
        /// </summary>
        private void ValidateAllRows()
        {
            for (int iRow = 0; iRow < shtView.RowCount; iRow++)
            {
                NZString   strItemCD      = new NZString(null, shtView.Cells[iRow, (int)eColumn.ITEM_CD].Value, null);
                NZString   strItemDesc    = new NZString(null, shtView.Cells[iRow, (int)eColumn.ITEM_DESC].Value, null);
                NZDateTime dtmRequireDate = new NZDateTime(null, shtView.Cells[iRow, (int)eColumn.DUE_DATE].Value, null);
                NZDecimal  decUnitPrice   = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.UNIT_PRICE].Value, null);
                NZDecimal  decQty         = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.PO_QTY].Value, null);
                NZString   strUnit        = new NZString(null, shtView.Cells[iRow, (int)eColumn.UNIT].Value, null);
                NZDecimal  decAmount      = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.AMOUNT].Value, null);
                NZDecimal  decReceiveQty  = new NZDecimal(null, shtView.Cells[iRow, (int)eColumn.RECEIVE_QTY].Value, 0);
                NZString   strStatus      = new NZString(null, shtView.Cells[iRow, (int)eColumn.STATUS].Value, null);

                #region Validateion before Generate DDTO
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strItemDesc, Messages.eValidate.VLM0129));
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDateTimeValue(dtmRequireDate, Messages.eValidate.VLM0130));
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDecimalValue(decUnitPrice, Messages.eValidate.VLM0131));
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strUnit, Messages.eValidate.VLM0133));
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDecimalValue(decQty, Messages.eValidate.VLM0132));
                ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckEmptyString(strStatus, Messages.eValidate.VLM0137));
                #endregion
            }
        }