示例#1
0
    private void UpdateView()
    {
        priceListdetail = ThePriceListDetailMgr.LoadPriceListDetail(Convert.ToInt32(this.code));
        TextBox          tbCode         = (TextBox)(this.FV_PriceListDetail.FindControl("tbCode"));
        TextBox          tbPriceList    = (TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"));
        TextBox          tbStartDate    = (TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"));
        TextBox          tbEndDate      = (TextBox)(this.FV_PriceListDetail.FindControl("tbEndDate"));
        TextBox          tbItem         = (TextBox)(this.FV_PriceListDetail.FindControl("tbItem"));
        Controls_TextBox tbCurrency     = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"));
        TextBox          tbUnitPrice    = (TextBox)(this.FV_PriceListDetail.FindControl("tbUnitPrice"));
        Controls_TextBox tbUom          = (Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbUom"));
        TextBox          tbTaxCode      = (TextBox)(this.FV_PriceListDetail.FindControl("tbTaxCode"));
        CheckBox         cbIsIncludeTax = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsIncludeTax"));

        // CheckBox cbIsProvEst = (CheckBox)(this.FV_PriceListDetail.FindControl("cbIsProvEst"));

        if (priceListdetail != null)
        {
            tbCode.Text      = priceListdetail.Id.ToString();
            tbPriceList.Text = priceListdetail.PriceList.Code;
            tbStartDate.Text = priceListdetail.StartDate.ToString("yyyy-MM-dd");
            if (priceListdetail.EndDate != null)
            {
                tbEndDate.Text = ((DateTime)priceListdetail.EndDate).ToString("yyyy-MM-dd");
            }
            tbItem.Text            = priceListdetail.Item.Code;
            tbCurrency.Text        = priceListdetail.Currency.Code;
            tbUnitPrice.Text       = priceListdetail.UnitPrice.ToString("0.########");
            tbUom.Text             = priceListdetail.Uom.Code;
            tbTaxCode.Text         = priceListdetail.TaxCode;
            cbIsIncludeTax.Checked = priceListdetail.IsIncludeTax;
            //  cbIsProvEst.Checked = priceListdetail.IsProvisionalEstimate;
        }
    }
示例#2
0
    public decimal GetUnitPriceByUom(string priceListCode, string itemCode, DateTime startTime, string currencyCode, string uomCode)
    {
        decimal unitPrice = 0;

        if (priceListCode != string.Empty)
        {
            PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(priceListCode, itemCode, startTime, currencyCode, uomCode);
            if (priceListDetail != null)
            {
                unitPrice = priceListDetail.UnitPrice;
            }
        }
        return(unitPrice);
    }
示例#3
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string code = ((LinkButton)sender).CommandArgument;

        try
        {
            ThePriceListDetailMgr.DeletePriceListDetail(Convert.ToInt32(code));
            ShowSuccessMessage("Common.Business.Result.Delete.Successfully");
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("Common.Business.Result.Delete.Failed");
        }
    }
示例#4
0
    public override void UpdateView()
    {
        List <PriceListDetail> priceListDetailList = new List <PriceListDetail>();
        PriceList priceList = null;
        Flow      flow      = TheFlowMgr.LoadFlow(this.FlowCode, true);

        if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_PO)
        {
            priceList = flow.PriceListFrom;
        }
        else if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_SO)
        {
            priceList = flow.PriceListTo;
        }
        if (priceList != null)
        {
            if (flow.FlowDetails != null && flow.FlowDetails.Count > 0)
            {
                foreach (FlowDetail flowDetail in flow.FlowDetails)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(priceList, flowDetail.Item, DateTime.Now, flow.Currency);
                    if (priceListDetail != null)
                    {
                        priceListDetailList.Add(priceListDetail);
                    }
                }
            }
        }
        if (priceListDetailList.Count > 0)
        {
            this.GV_List.DataSource = priceListDetailList;
            this.GV_List.DataBind();
        }
        else
        {
            this.Parent.Visible = false;
        }
    }
示例#5
0
    public string AdjustInProcessLocationTo()
    {
        try
        {
            InProcessLocation ip      = TheInProcessLocationMgr.LoadInProcessLocation(this.IpNo, true);
            Receipt           receipt = new Receipt();
            InProcessLocation nmlIp   = CloneHelper.DeepClone(ip);
            IList <InProcessLocationDetail> nmlReceiptDetailList = new List <InProcessLocationDetail>();
            foreach (InProcessLocationDetail ipdet in ip.InProcessLocationDetails)
            {
                #region 对应的ipdet
                InProcessLocationDetail nmlInProcessLocationDetail = new InProcessLocationDetail();
                nmlInProcessLocationDetail.Qty = 0 - ipdet.Qty;
                nmlInProcessLocationDetail.OrderLocationTransaction = TheOrderLocationTransactionMgr.GetOrderLocationTransaction(ipdet.OrderLocationTransaction.OrderDetail, BusinessConstants.IO_TYPE_IN)[0];
                nmlInProcessLocationDetail.IsConsignment            = ipdet.IsConsignment;
                nmlInProcessLocationDetail.PlannedBill = ipdet.PlannedBill;
                nmlReceiptDetailList.Add(nmlInProcessLocationDetail);
                #endregion

                #region 收货单明细
                ReceiptDetail receiptDetail = new ReceiptDetail();
                receiptDetail.Receipt     = receipt;
                receiptDetail.ReceivedQty = nmlInProcessLocationDetail.Qty;
                receiptDetail.ShippedQty  = nmlInProcessLocationDetail.Qty;
                receiptDetail.OrderLocationTransaction = nmlInProcessLocationDetail.OrderLocationTransaction;
                receiptDetail.IsConsignment            = ipdet.IsConsignment;
                nmlInProcessLocationDetail.PlannedBill = ipdet.PlannedBill;

                OrderDetail orderDetail = receiptDetail.OrderLocationTransaction.OrderDetail;

                OrderHead orderHead = orderDetail.OrderHead;

                if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListFrom, orderDetail.Item, DateTime.Now, orderDetail.OrderHead.Currency);
                    if (priceListDetail == null)
                    {
                        throw new BusinessErrorException("Order.Error.NoPriceListReceipt", new string[] { orderDetail.Item.Code });
                    }
                    receiptDetail.PlannedAmount = priceListDetail.UnitPrice * (decimal)receiptDetail.ReceivedQty;
                }
                else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(orderDetail.DefaultPriceListTo, orderDetail.Item, DateTime.Now, orderDetail.OrderHead.Currency);
                    if (priceListDetail == null)
                    {
                        throw new BusinessErrorException("Order.Error.NoPriceListReceipt", new string[] { orderDetail.Item.Code });
                    }
                    receiptDetail.PlannedAmount = priceListDetail.UnitPrice * (decimal)receiptDetail.ReceivedQty;
                }

                receipt.AddReceiptDetail(receiptDetail);
                #endregion
            }


            nmlIp.InProcessLocationDetails = nmlReceiptDetailList;
            if (receipt.InProcessLocations == null)
            {
                receipt.InProcessLocations = new List <InProcessLocation>();
            }
            receipt.InProcessLocations.Add(nmlIp);

            TheReceiptMgr.CreateReceipt(receipt, this.CurrentUser);
            return(receipt.ReceiptNo);
        }
        catch (BusinessErrorException ex)
        {
            throw (ex);
        }
    }
示例#6
0
    public FlowDetailProxy GenerateFlowDetailProxy(string flowCode, string itemCode, string moduleType, string partyFromCode, string partyToCode, bool changeRef, DateTime startTime)
    {
        IList <FlowDetail> flowDetailList = TheFlowDetailMgr.GetFlowDetail(flowCode, true);

        if (flowDetailList != null && flowDetailList.Count > 0)
        {
            foreach (FlowDetail fd in flowDetailList)
            {
                if (fd.Item.Code == itemCode)
                {
                    FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
                    flowDetailProxy.ItemCode        = fd.Item.Code;
                    flowDetailProxy.ItemDescription = fd.Item.Description;
                    if (changeRef)
                    {
                        flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                    }
                    flowDetailProxy.UomCode   = fd.Uom.Code;
                    flowDetailProxy.UnitCount = fd.UnitCount;
                    flowDetailProxy.HuLotSize = fd.HuLotSize == null?Convert.ToInt32(fd.UnitCount) : fd.HuLotSize;

                    if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                    {
                        if (fd.DefaultPriceListFrom != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListFrom.Code;
                            PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListFrom, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailFrom != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                            }
                        }
                    }
                    else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                    {
                        if (fd.DefaultPriceListTo != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListTo.Code;
                            PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListTo, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailTo != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                            }
                        }
                        flowDetailProxy.PackageVolumn = fd.PackageVolumn;
                    }

                    if (changeRef)
                    {
                        if (fd.ReferenceItemCode != null && fd.ReferenceItemCode != string.Empty)
                        {
                            flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                        }
                        else
                        {
                            flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
                        }
                    }
                    return(flowDetailProxy);
                }
            }
        }

        Item item = TheItemMgr.LoadItem(itemCode);

        if (item != null)
        {
            Flow            flow            = TheFlowMgr.LoadFlow(flowCode);
            FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
            flowDetailProxy.ItemCode        = item.Code;
            flowDetailProxy.ItemDescription = item.Description;
            flowDetailProxy.UomCode         = item.Uom.Code;

            if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
            {
                if (flow.PriceListFrom != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListFrom.Code;
                    PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListFrom, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailFrom != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                    }
                }
            }
            else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                if (flow.PriceListTo != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListTo.Code;
                    PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListTo, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailTo != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                    }
                }
            }

            if (changeRef)
            {
                flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
            }
            flowDetailProxy.UnitCount = item.UnitCount;
            flowDetailProxy.HuLotSize = Convert.ToInt32(item.UnitCount);
            return(flowDetailProxy);
        }

        return(null);
    }
示例#7
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvUom":

            if (TheUomMgr.LoadUom(args.Value) == null)
            {
                ShowWarningMessage("MasterData.PriceList.UomInvalid", args.Value);
                args.IsValid = false;
            }

            break;

        case "cvItem":

            if (TheItemMgr.LoadItem(args.Value.Trim()) == null)
            {
                ShowWarningMessage("MasterData.Item.Code.NotExist");
                args.IsValid = false;
            }
            else
            {
                string   priceListCode = ((TextBox)(this.FV_PriceListDetail.FindControl("tbPriceList"))).Text.Trim();
                string   currencyCode  = ((Controls_TextBox)(this.FV_PriceListDetail.FindControl("tbCurrency"))).Text.Trim();
                DateTime startDate     = Convert.ToDateTime(((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim());
                if (ThePriceListDetailMgr.LoadPriceListDetail(priceListCode, startDate, args.Value.Trim(), currencyCode) != null)
                {
                    ShowWarningMessage("MasterData.PriceListDetail.UniqueExistError");
                    args.IsValid = false;
                }
            }
            break;

        case "cvPriceList":

            if (ThePriceListMgr.LoadPriceList(args.Value) == null)
            {
                ShowWarningMessage("MasterData.PriceList.Code.NotExist");
                args.IsValid = false;
            }
            break;

        case "cvUnitPrice":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.PriceListDetail.UnitPrice.Error");
                args.IsValid = false;
            }
            break;

        case "cvStartDate":
            try
            {
                Convert.ToDateTime(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvEndDate":
            try
            {
                if (args.Value.Trim() != "")
                {
                    DateTime startDate = Convert.ToDateTime(((TextBox)(this.FV_PriceListDetail.FindControl("tbStartDate"))).Text.Trim());
                    if (DateTime.Compare(startDate, Convert.ToDateTime(args.Value)) >= 0)
                    {
                        ShowErrorMessage("MasterData.PriceList.TimeCompare");
                        args.IsValid = false;
                    }
                }
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvCurrency":
            if (args.Value.Trim() != "")
            {
                if (TheCurrencyMgr.LoadCurrency(args.Value) == null)
                {
                    ShowWarningMessage("MasterData.Currency.Code.NotExist", args.Value);
                    args.IsValid = false;
                }
            }
            break;

        default:
            break;
        }
    }