Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo 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);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Check PO Details, there cannot has the same ItemCode, DueDate and UnitPrice.
        /// </summary>
        /// <returns>ErrorItem if Has Dupplication.</returns>
        private ErrorItem ValidateDupplicateItem()
        {
            int iRow = shtView.ActiveRowIndex;

            if (shtView.Cells[iRow, (int)eColumn.ITEM_CD].Value == null ||
                shtView.Cells[iRow, (int)eColumn.DUE_DATE].Value == null ||
                shtView.Cells[iRow, (int)eColumn.UNIT_PRICE].Value == null)
            {
                return(null);
            }

            PurchaseOrderDDTO dDTOChk = new PurchaseOrderDDTO
            {
                ITEM_CD    = (NZString)Convert.ToString(shtView.Cells[iRow, (int)eColumn.ITEM_CD].Value),
                DUE_DATE   = (NZDateTime)Convert.ToDateTime(shtView.Cells[iRow, (int)eColumn.DUE_DATE].Value),
                UNIT_PRICE = (NZDecimal)Convert.ToDecimal(shtView.Cells[iRow, (int)eColumn.UNIT_PRICE].Value)
            };

            List <PurchaseOrderDDTO> dDTOPOList = new List <PurchaseOrderDDTO>();

            for (int i = 0; i < shtView.Rows.Count; i++)
            {
                if (shtView.Cells[i, (int)eColumn.ITEM_CD].Value == null ||
                    shtView.Cells[i, (int)eColumn.DUE_DATE].Value == null ||
                    shtView.Cells[i, (int)eColumn.UNIT_PRICE].Value == null)
                {
                    continue;
                }

                if (i != iRow)
                {
                    PurchaseOrderDDTO dDTOTmp = new PurchaseOrderDDTO
                    {
                        ITEM_CD    = (NZString)Convert.ToString(shtView.Cells[i, (int)eColumn.ITEM_CD].Value),
                        DUE_DATE   = (NZDateTime)Convert.ToDateTime(shtView.Cells[i, (int)eColumn.DUE_DATE].Value),
                        UNIT_PRICE = (NZDecimal)Convert.ToDecimal(shtView.Cells[i, (int)eColumn.UNIT_PRICE].Value)
                    };
                    dDTOPOList.Add(dDTOTmp);
                }
            }
            ErrorItem errItem = PurchaseOrderEntryValidation.CheckDupItemByDTO(dDTOChk, dDTOPOList);

            if (errItem != null)
            {
                shtView.Cells[shtView.ActiveRowIndex, shtView.ActiveColumnIndex].Value = null;
            }
            return(errItem);
        }
Ejemplo n.º 5
0
        private void LoadItemDesc(int iRow)
        {
            try
            {
                #region validateion
                List <string> strItemCDList = new List <string>();
                for (int i = 0; i < shtView.Rows.Count; i++)
                {
                    if (i != iRow)
                    {
                        strItemCDList.Add(Convert.ToString(shtView.Cells[i, (int)eColumn.ITEM_CD].Value));
                    }
                }
                ErrorItem errItem = PurchaseOrderEntryValidation.CheckDupItem
                                        (new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value), strItemCDList);
                if (errItem != null)
                {
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value   = string.Empty;
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = string.Empty;
                    ValidateException.ThrowErrorItem(errItem);
                }
                #endregion

                ItemBIZ bizItem = new ItemBIZ();
                ItemDTO dtoItem = bizItem.LoadItem((NZString)Convert.ToString(shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value));

                if (dtoItem != null)
                {
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = Convert.ToString(dtoItem.ITEM_DESC);
                }
                else
                {
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = string.Empty;
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
        }
Ejemplo n.º 6
0
        private void fpView_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            try
            {
                eItemType[]    itemTypeEnum = { eItemType.All };
                ItemFindDialog dialog       = new ItemFindDialog(eSqlOperator.Equal, itemTypeEnum);
                dialog.ShowDialog(this);
                if (dialog.IsSelected)
                {
                    #region validateion
                    int           iRow          = shtView.ActiveRowIndex;
                    List <string> strItemCDList = new List <string>();
                    for (int i = 0; i < shtView.Rows.Count; i++)
                    {
                        if (i != iRow)
                        {
                            strItemCDList.Add(Convert.ToString(shtView.Cells[i, (int)eColumn.ITEM_CD].Value));
                        }
                    }
                    ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDupItem(dialog.SelectedItem.ITEM_CD, strItemCDList));
                    #endregion

                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value   = dialog.SelectedItem.ITEM_CD.ToString();
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = dialog.SelectedItem.ITEM_DESC.ToString();
                }
            }
            catch (BusinessException err)
            {
                MessageDialog.ShowBusiness(this, err.Error.Message);
                err.Error.FocusOnControl();
            }
            catch (ValidateException err)
            {
                MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message);
                err.ErrorResults[0].FocusOnControl();
            }
        }
Ejemplo n.º 7
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
            }
        }