Beispiel #1
0
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                // Get Visible
                var _graph        = PXGraph.CreateInstance <SOOrderEntry>();
                var _PIPreference = from t in _graph.Select <LifeSyncPreference>()
                                    select t;
                var _visible = _PIPreference.FirstOrDefault() == null ? false : _PIPreference.FirstOrDefault().ProformaInvoicePrinting.Value
                                                                      ? true : false;
                // Set Button Visible
                ProformaInvoice.SetVisible(_visible);
                // Add Button
                if (_visible)
                {
                    Base.report.AddMenuAction(ProformaInvoice);
                }

                Base.report.AddMenuAction(DeliveryOrderReport);

                Base.action.AddMenuAction(DispatchNoteReport);
                Base.action.AddMenuAction(ReturnNoteReport);
                Base.action.MenuAutoOpen = true;
            }
        }
Beispiel #2
0
        public virtual void _(Events.RowSelected <POOrder> e)
        {
            var _library   = new LumLibrary();
            var BaseCuryID = _library.GetCompanyBaseCuryID();

            PXUIFieldAttribute.SetDisplayName <POOrder.orderTotal>(e.Cache, $"Total in {BaseCuryID}");
            PXUIFieldAttribute.SetVisible <POOrder.orderTotal>(e.Cache, null, _library.GetShowingTotalInHome);
        }
        /// <summary> Row Selected Event </summary>
        protected virtual void _(Events.RowSelected <ARAdjust> e, PXRowSelected BaseMethod)
        {
            BaseMethod(e.Cache, e.Args);
            var library = new LumLibrary();

            PXUIFieldAttribute.SetVisible <ARAdjustExtension.usrBaseBalance>(e.Cache, null, library.GetCrossRateOverride);
            PXUIFieldAttribute.SetVisible <ARAdjust.curyAdjdAmt>(e.Cache, null, library.GetCrossRateOverride);
        }
        protected void _(Events.RowSelected <Batch> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                GLJournalAction.SetVisible(false);
            }
        }
        protected void _(Events.RowSelected <INPIHeader> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                CountintListReport.SetVisible(false);
            }
        }
Beispiel #6
0
        protected void _(Events.RowSelected <INRegister> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                InventoryIssueReport.SetVisible(false);
            }
        }
        protected void _(Events.RowSelected <AMVendorShipment> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                VendorShipment.SetVisible(false);
            }
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(VendorShipment);
            }
        }
Beispiel #9
0
        public override void Initialize()
        {
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                ReportAction.AddMenuAction(ProductionMoveAction);
                ReportAction.MenuAutoOpen = true;
            }
        }
Beispiel #10
0
        protected void _(Events.RowSelected <AMBatch> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                ReportAction.SetVisible(false);
                ProductionMoveAction.SetVisible(false);
            }
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(GLJournalAction);
            }
        }
Beispiel #12
0
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(InventoryIssueReport);
            }
        }
        protected void _(Events.RowSelected <POReceipt> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                POReceipt.SetVisible(false);
                POReturn.SetVisible(false);
            }
        }
        protected void _(Events.RowSelected <AMProdItem> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                ProductionInstruction.SetVisible(false);
                InnerLabel.SetVisible(false);
            }
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.actionsFolder.AddMenuAction(CountintListReport);
            }
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(CommercialInvoiceReport);
                Base.report.AddMenuAction(CreditNoteReport);
            }
        }
Beispiel #17
0
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(DomesticPO);
                Base.report.AddMenuAction(OverseasPO);
            }
        }
        public virtual void _(Events.RowSelected <APInvoice> e)
        {
            var _library   = new LumLibrary();
            var BaseCuryID = _library.GetCompanyBaseCuryID();

            PXUIFieldAttribute.SetDisplayName <APInvoice.lineTotal>(e.Cache, $"Total in {BaseCuryID}");
            PXUIFieldAttribute.SetVisible <APInvoice.lineTotal>(e.Cache, null, _library.GetShowingTotalInHome);
            // Hide Standard Field
            PXUIFieldAttribute.SetVisible <APInvoice.curyOrigDiscAmt>(e.Cache, null, !_library.GetShowingTotalInHome);
            PXUIFieldAttribute.SetVisible <APInvoice.curyOrigWhTaxAmt>(e.Cache, null, !_library.GetShowingTotalInHome);
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(ProductionInstruction);
                Base.report.AddMenuAction(InnerLabel);
            }
        }
        public override void Initialize()
        {
            base.Initialize();
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                Base.report.AddMenuAction(POReceipt);
                Base.report.AddMenuAction(POReturn);
            }
        }
Beispiel #21
0
        public override void Initialize()
        {
            var _lumLibrary = new LumLibrary();

            if (_lumLibrary.isCNorHK())
            {
                ReportAction.AddMenuAction(MaterialIssuesAction);
                ReportAction.AddMenuAction(MaterialReturnAction);
                ReportAction.MenuAutoOpen = true;
            }
        }
Beispiel #22
0
        protected void _(Events.RowSelected <AMBatch> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                ReportAction.SetVisible(false);
                MaterialIssuesAction.SetVisible(false);
                MaterialReturnAction.SetVisible(false);
            }
        }
Beispiel #23
0
        protected void _(Events.RowSelected <SOShipment> e)
        {
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                ProformaInvoice.SetVisible(false);
                DeliveryOrderReport.SetVisible(false);
                DispatchNoteReport.SetVisible(false);
                ReturnNoteReport.SetVisible(false);
            }
        }
        public virtual void _(Events.RowSelected <ARInvoice> e)
        {
            var _library          = new LumLibrary();
            var baseCompanyCuryID = _library.GetCompanyBaseCuryID();

            // Setting LineTotal
            PXUIFieldAttribute.SetDisplayName <ARInvoice.lineTotal>(e.Cache, $"Total in {baseCompanyCuryID}");
            PXUIFieldAttribute.SetVisible <ARInvoice.lineTotal>(e.Cache, null, _library.GetShowingTotalInHome);
            PXUIFieldAttribute.SetEnabled <ARInvoice.lineTotal>(e.Cache, null, false);
            // Hide CuryOrigDiscAmt
            PXUIFieldAttribute.SetVisible <ARInvoice.curyOrigDiscAmt>(e.Cache, null, !_library.GetShowingTotalInHome);

            //controll customize button based on country ID
            if (!_library.isCNorHK())
            {
                CommercialInvoiceReport.SetVisible(false);
                CreditNoteReport.SetVisible(false);
            }
        }
Beispiel #25
0
        public virtual void _(Events.RowSelected <ARInvoice> e)
        {
            var library           = new LumLibrary();
            var BaseComapnyCuryID = library.GetCompanyBaseCuryID();

            PXUIFieldAttribute.SetDisplayName <ARInvoice.lineTotal>(e.Cache, $"Total in {BaseComapnyCuryID}");
            PXUIFieldAttribute.SetEnabled <ARInvoice.lineTotal>(e.Cache, null, false);
            // Defaul Visiable is false
            PXUIFieldAttribute.SetVisible <ARInvoice.lineTotal>(e.Cache, null, library.GetShowingTotalInHome);

            //controll customize button based on country ID
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                CommercialInvoiceReport.SetVisible(false);
                CreditNoteReport.SetVisible(false);
                CommercialInvoiceFromDGReport.SetVisible(false);
            }
        }
Beispiel #26
0
        protected virtual void _(Events.RowSelected <POLine> e)
        {
            // Control Header PI Column Visible
            var _graph        = PXGraph.CreateInstance <POOrderEntry>();
            var _PIPreference = from t in _graph.Select <LifeSyncPreference>()
                                select t;
            var _visible = _PIPreference.FirstOrDefault() == null ? false :
                           _PIPreference.FirstOrDefault().BubbleNumberPrinting.HasValue ? _PIPreference.FirstOrDefault().BubbleNumberPrinting.Value : false;

            PXUIFieldAttribute.SetVisible <POLineExt.usrBubbleNumber>(e.Cache, null, _visible);

            //controll customize button based on country ID
            var _lumLibrary = new LumLibrary();

            if (!_lumLibrary.isCNorHK())
            {
                DomesticPO.SetVisible(false);
                OverseasPO.SetVisible(false);
            }
        }
Beispiel #27
0
        /// <summary> SOOrder RowSelected Event </summary>
        protected virtual void _(Events.RowSelected <SOOrder> e)
        {
            var _library = new LumLibrary();

            PXUIFieldAttribute.SetVisible <SOOrderExt.usrPICustomerID>(e.Cache, null, _library.GetProformaInvoicePrinting);
            PXUIFieldAttribute.SetVisible <SOOrderExt.usrPICuryID>(e.Cache, null, _library.GetProformaInvoicePrinting);

            // Control Line PI Column Visible
            var _lineCache = Base.Transactions.Cache;

            PXUIFieldAttribute.SetVisible <SOLineExt.usrPIUnitPrice>(_lineCache, null, _library.GetProformaInvoicePrinting);
            PXUIFieldAttribute.SetEnabled <SOLineExt.usrPIUnitPrice>(_lineCache, null, _library.GetProformaInvoicePrinting);

            // Reset OrderToal Display Name
            var baseCompanyCuryID = _library.GetCompanyBaseCuryID();

            PXUIFieldAttribute.SetDisplayName <SOOrder.orderTotal>(e.Cache, $"Total in {baseCompanyCuryID}");
            PXUIFieldAttribute.SetEnabled <SOOrder.orderTotal>(e.Cache, null, false);
            PXUIFieldAttribute.SetVisible <SOOrder.orderTotal>(e.Cache, null, _library.GetShowingTotalInHome);
        }
Beispiel #28
0
        public ICMSummary GetICMData(AMProdItem row)
        {
            #region Varaible
            int     rowNum      = 0;
            decimal materialSum = 0;

            ICMSummary summaryResult = new ICMSummary();
            // Currency Rate Type of ICM
            var graphProdDetail = PXGraph.CreateInstance <ProdDetail>();
            var iCMRateType     = PXGraph.CreateInstance <InternalCostModelMaint>().Select <LifeSyncPreference>().Select(x => x.InternalCostModelRateType).FirstOrDefault();
            var aMProdAttribute = SelectFrom <AMProdAttribute> .Where <AMProdAttribute.orderType.IsEqual <P.AsString>
                                                                       .And <AMProdAttribute.prodOrdID.IsEqual <P.AsString> > > .View.Select(this, row.OrderType, row.ProdOrdID).RowCast <AMProdAttribute>().ToList();

            // Get Stock Item Vendor Details By LastModifierTime
            var pOvenderDetail = PXGraph.CreateInstance <InternalCostModelMaint>()
                                 .Select <POVendorInventory>()
                                 .ToList()
                                 .Where(x => x.IsDefault ?? false)
                                 .GroupBy(x => new { x.InventoryID })
                                 .Select(x => x.OrderByDescending(y => y.LastModifiedDateTime).FirstOrDefault());
            var taxInfo = (from v in new PXGraph().Select <Vendor>()
                           join t in new PXGraph().Select <PX.Objects.CR.Location>()
                           on v.BAccountID equals t.BAccountID
                           join z in new PXGraph().Select <TaxZoneDet>()
                           on t.VTaxZoneID equals z.TaxZoneID
                           join r in new PXGraph().Select <TaxRev>()
                           on z.TaxID equals r.TaxID
                           where r.TaxType == "P"
                           select new
            {
                vendorID = v.BAccountID,
                taxRate = r.TaxRate
            }).ToList().GroupBy(x => x.vendorID).Select(x => x.First());
            // Get All Material Data
            var materialData = from t in PXGraph.CreateInstance <InternalCostModelMaint>().Select <AMProdMatl>()
                               where t.OrderType == row.OrderType && t.ProdOrdID == row.ProdOrdID
                               select t;
            var aMProdMaterail = from t in materialData.ToList()
                                 join i in PXGraph.CreateInstance <InternalCostModelMaint>().Select <InventoryItem>()
                                 on t.InventoryID equals i.InventoryID
                                 join v in pOvenderDetail
                                 on t.InventoryID equals v.InventoryID into result
                                 from r in result.DefaultIfEmpty()
                                 join x in taxInfo
                                 on r?.VendorID ?? -1 equals x.vendorID into taxResult
                                 from _tax in taxResult.DefaultIfEmpty()
                                 orderby i.InventoryCD
                                 select new
            {
                t.InventoryID,
                t.Descr,
                t.UnitCost,
                t.UOM,
                t.TotalQtyRequired,
                t.ScrapFactor,
                t.QtyReq,
                i.InventoryCD,
                t.BatchSize,
                venderDetail = r,
                taxInfo      = _tax
            };
            var _AMProdOper = SelectFrom <AMProdOper> .Where <AMProdOper.orderType.IsEqual <P.AsString>
                                                              .And <AMProdOper.prodOrdID.IsEqual <P.AsString> > > .View.Select(this, row.OrderType, row.ProdOrdID).RowCast <AMProdOper>().ToList();

            // ReplenishmentSource From Inventory
            var _InventoryItem = PXGraph.CreateInstance <InternalCostModelMaint>().Select <INItemSite>().Select(x => new { x.InventoryID, x.ReplenishmentSource });
            // Effect Curry Rate
            var _EffectCuryRate = new LumLibrary().GetCuryRateRecordEffData(this).Where(x => x.CuryRateType == iCMRateType).ToList();
            if (_EffectCuryRate.Count == 0)
            {
                throw new PXException("Please Select ICM Rate Type !!");
            }

            decimal _SetUpSum            = 0;
            decimal _TotalCost           = 0;
            var     _StandardWorkingTime = (_AMProdOper.Sum(x => x.RunUnitTime) / _AMProdOper.Sum(x => x.RunUnits)).Value;
            // AMProdAttribute
            var _ENDC        = aMProdAttribute.Where(x => x.AttributeID.Equals("ENDC")).FirstOrDefault()?.Value;
            var _EAU         = aMProdAttribute.Where(x => x.AttributeID.Equals("EAU")).FirstOrDefault()?.Value;
            var _LBSCCost    = aMProdAttribute.Where(x => x.AttributeID == "LBSC").FirstOrDefault()?.Value ?? "0";
            var _MFSCCost    = aMProdAttribute.Where(x => x.AttributeID == "MFSC").FirstOrDefault()?.Value ?? "0";
            var _OHSCCost    = aMProdAttribute.Where(x => x.AttributeID == "OHSC").FirstOrDefault()?.Value ?? "0";
            var _SETUPSCCost = aMProdAttribute.Where(x => x.AttributeID == "SETUPSC").FirstOrDefault()?.Value ?? "0";
            var _PRODYIELD   = aMProdAttribute.Where(x => x.AttributeID == "PRODYIELD").FirstOrDefault()?.Value ?? "0";
            var _ABADGSELL   = aMProdAttribute.Where(x => x.AttributeID == "ABADGSELL").FirstOrDefault()?.Value ?? "0";
            var _HKOHSCCost  = aMProdAttribute.Where(x => x.AttributeID == "HKOHSC").FirstOrDefault()?.Value ?? "0";
            var _ABISELLCost = aMProdAttribute.Where(x => x.AttributeID == "ABISELL").FirstOrDefault()?.Value ?? "0";
            #endregion

            #region 1.Material Cost Row(7~rowNum)
            foreach (var matl in aMProdMaterail)
            {
                var     QPA                  = (matl?.QtyReq / matl?.BatchSize) ?? 1;
                decimal?_materailCost        = 0;
                var     _ReplenishmentSource = _InventoryItem.Where(x => x.InventoryID == matl.InventoryID)
                                               .FirstOrDefault()?.ReplenishmentSource ?? "";

                // IF Purchase Unit != Matailes UOM
                if (matl.venderDetail != null && (matl.venderDetail.LastPrice ?? 0) > 0)
                {
                    var _venderLastPrice = matl.venderDetail.LastPrice.Value;
                    if (matl.venderDetail.PurchaseUnit != matl.UOM)
                    {
                        var _INUnit = from t in PXGraph.CreateInstance <InternalCostModelMaint>().Select <INUnit>()
                                      where t.InventoryID == matl.InventoryID &&
                                      t.FromUnit == matl.venderDetail.PurchaseUnit &&
                                      t.ToUnit == matl.UOM
                                      select t;
                        _venderLastPrice = _INUnit == null ? _venderLastPrice
                                                           : _INUnit.FirstOrDefault().UnitMultDiv == "M" ? _venderLastPrice / (_INUnit.FirstOrDefault()?.UnitRate ?? 1)
                                                                                                         : _venderLastPrice * (_INUnit.FirstOrDefault()?.UnitRate ?? 1);
                    }

                    if (matl.venderDetail.CuryID == "CNY")
                    {
                        // 不含Tax
                        _venderLastPrice = (_venderLastPrice / (1 + (matl?.taxInfo?.taxRate ?? 0) / 100));
                        _materailCost    = _venderLastPrice * Math.Round(QPA, 4)
                                           * (_EffectCuryRate.Where(x => x.FromCuryID == "USD" && x.ToCuryID == "CNY").FirstOrDefault()?.RateReciprocal ?? 1);
                    }
                    else if (matl.venderDetail.CuryID == "HKD")
                    {
                        _materailCost = _venderLastPrice * Math.Round(QPA, 4)
                                        * (_EffectCuryRate.Where(x => x.FromCuryID == "HKD" && x.ToCuryID == "CNY").FirstOrDefault()?.CuryRate ?? 1)
                                        * (_EffectCuryRate.Where(x => x.FromCuryID == "USD" && x.ToCuryID == "CNY").FirstOrDefault()?.RateReciprocal ?? 1);
                    }
                    else if (matl.venderDetail.CuryID == "USD")
                    {
                        _materailCost = _venderLastPrice * Math.Round(QPA, 4);
                    }
                }
                else
                {
                    _materailCost = (matl.UnitCost.HasValue ? matl.UnitCost.Value : 0) * Math.Round(QPA, 4)
                                    * (_EffectCuryRate.Where(x => x.FromCuryID == "USD" && x.ToCuryID == "CNY").FirstOrDefault()?.RateReciprocal ?? 1);
                }
                materialSum += _materailCost ?? 0;
            }

            // Materail Sum
            summaryResult.MaterialCost = materialSum;
            _SetUpSum += materialSum;
            #endregion

            #region 2.Labor Cost

            summaryResult.StandardTime = _StandardWorkingTime;
            summaryResult.LabourCost   = (_StandardWorkingTime * decimal.Parse(_LBSCCost) *
                                          _EffectCuryRate.Where(x => x.FromCuryID == "USD").FirstOrDefault()
                                          .RateReciprocal).Value;;
            // Sum
            _SetUpSum += (_StandardWorkingTime * decimal.Parse(_LBSCCost) * _EffectCuryRate.Where(x => x.FromCuryID == "USD").FirstOrDefault().RateReciprocal).Value;

            #endregion

            #region 3.Manufacture Cost
            summaryResult.ManufactureCost = (_StandardWorkingTime * decimal.Parse(_MFSCCost) / _EffectCuryRate.FirstOrDefault(x => x.FromCuryID == "USD").CuryRate.Value);
            _SetUpSum += (_StandardWorkingTime * decimal.Parse(_MFSCCost) * _EffectCuryRate.FirstOrDefault(x => x.FromCuryID == "USD").RateReciprocal).Value;
            #endregion

            #region 4.Overhead
            // Standard cost
            summaryResult.Overhead = (_StandardWorkingTime * decimal.Parse(_OHSCCost) /
                                      _EffectCuryRate.FirstOrDefault(x => x.FromCuryID == "USD").CuryRate.Value);
            _SetUpSum += (_StandardWorkingTime * decimal.Parse(_OHSCCost) / _EffectCuryRate.FirstOrDefault(x => x.FromCuryID == "USD").RateReciprocal).Value;
            #endregion

            #region 6.Production yield
            // Sum
            _TotalCost = (summaryResult.MaterialCost + summaryResult.LabourCost +
                          summaryResult.ManufactureCost + summaryResult.Overhead).Value /
                         (1 - decimal.Parse(_PRODYIELD) / 100);
            summaryResult.DGPrice  = _TotalCost;
            summaryResult.Lumyield = _TotalCost - (summaryResult.MaterialCost + summaryResult.LabourCost +
                                                   summaryResult.ManufactureCost + summaryResult.Overhead).Value;
            #endregion

            #region 7.ABA DG Sell price
            // Sum
            var _abaDGPrice     = _TotalCost + (_TotalCost * (decimal.Parse(_ABADGSELL) / 100));
            var _abaDGPrice_HKD = _abaDGPrice * _EffectCuryRate.Where(x => x.FromCuryID == "USD").FirstOrDefault()?.CuryRate *_EffectCuryRate.Where(x => x.FromCuryID == "HKD").FirstOrDefault()?.RateReciprocal;
            summaryResult.DGtoHKPrice = (decimal.Parse(_ABADGSELL) + summaryResult.DGPrice);
            #endregion

            #region 9.ABA HK Sell Price
            // Sum
            var _hkPrice = summaryResult.DGPrice + (decimal.Parse(_HKOHSCCost) * _StandardWorkingTime) + (decimal.Parse(_HKOHSCCost) * (decimal.Parse(_HKOHSCCost) * _StandardWorkingTime));
            summaryResult.HKPrice = _hkPrice.Value;

            #endregion

            #region 10.ABI Sell Price
            // Sum
            summaryResult.ABIPrice = (summaryResult.Lumyield + (decimal.Parse(_HKOHSCCost) * _StandardWorkingTime)) /
                                     (1 - decimal.Parse(_ABISELLCost) / 100);
            #endregion

            return(summaryResult);
        }