Ejemplo n.º 1
0
        public void OnReleaseComplete(ICADocument doc, OnReleaseCompleteDelegate baseMethod)
        {
            CAAdj cAAdj = doc as CAAdj;

            if (TWNGUIValidation.ActivateTWGUI(Base) == true &&
                cAAdj != null &&
                cAAdj.Released == true &&
                cAAdj.AdjTranType == CATranType.CAAdjustment)
            {
                TWNReleaseProcess rp = PXGraph.CreateInstance <TWNReleaseProcess>();

                PXSelectBase <TWNManualGUIBank> ViewManGUIBank = new SelectFrom <TWNManualGUIBank> .Where <TWNManualGUIBank.adjRefNbr.IsEqual <@P.AsString> > .View(Base);

                foreach (TWNManualGUIBank manualGUIBank in ViewManGUIBank.Cache.Cached)
                {
                    if (PXCache <Tax> .GetExtension <TaxExt>(Tax.PK.Find(Base, manualGUIBank.TaxID)).UsrTWNGUI.Equals(false))
                    {
                        continue;
                    }

                    using (PXTransactionScope ts = new PXTransactionScope())
                    {
                        rp.CreateGUITrans(new STWNGUITran()
                        {
                            VATCode      = manualGUIBank.VATInCode,
                            GUINbr       = manualGUIBank.GUINbr,
                            GUIStatus    = TWNGUIStatus.Used,
                            BranchID     = Base.CATranCashTrans_Ordered.Current.BranchID,
                            GUIDirection = TWNGUIDirection.Receipt,
                            GUIDate      = manualGUIBank.GUIDate,
                            GUITitle     = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                                typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                                typeof(Vendor.acctName).Name),
                            TaxZoneID     = manualGUIBank.TaxZoneID,
                            TaxCategoryID = manualGUIBank.TaxCategoryID,
                            TaxID         = manualGUIBank.TaxID,
                            TaxNbr        = manualGUIBank.TaxNbr,
                            OurTaxNbr     = manualGUIBank.OurTaxNbr,
                            NetAmount     = manualGUIBank.NetAmt,
                            TaxAmount     = manualGUIBank.TaxAmt,
                            AcctCD        = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                                 typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                                 typeof(Vendor.acctCD).Name),
                            AcctName = (string)PXSelectorAttribute.GetField(ViewManGUIBank.Cache, manualGUIBank,
                                                                            typeof(APRegister.vendorID).Name, manualGUIBank.VendorID,
                                                                            typeof(Vendor.acctName).Name),
                            DeductionCode = manualGUIBank.Deduction,
                            Remark        = manualGUIBank.Remark,
                            OrderNbr      = manualGUIBank.AdjRefNbr
                        });

                        ts.Complete(Base);
                    }
                }
            }

            baseMethod(doc);
        }
Ejemplo n.º 2
0
 protected virtual void ReverseCharges(ICADocument oldDoc, ICADocument newDoc, bool reverseSign)
 {
     foreach (PXResult <ChargeTable> paycharge in PXSelect <ChargeTable,
                                                            Where <ChargeRefNbr, Equal <Required <ChargeRefNbr> > > > .Select(this._Graph, oldDoc.RefNbr))
     {
         ChargeTable charge = ReverseCharge((ChargeTable)paycharge, reverseSign);
         this.Insert(charge);
     }
 }
Ejemplo n.º 3
0
        protected virtual void ReverseCharges(ICADocument oldDoc, ICADocument newDoc, bool reverseSign)
        {
            foreach (PXResult <ChargeTable> paycharge in PXSelect <ChargeTable,
                                                                   Where <ChargeRefNbr, Equal <Required <ChargeRefNbr> > > > .Select(this._Graph, oldDoc.RefNbr))
            {
                ChargeTable charge = PXCache <ChargeTable> .CreateCopy((ChargeTable)paycharge);

                CurrencyInfo chargeInfo = CreateCuryInfo(charge);

                charge.DocType     = CATranType.CATransferExp;
                charge.CuryInfoID  = chargeInfo.CuryInfoID;
                charge.RefNbr      = null;
                charge.CuryTranAmt = (reverseSign ? -1 : 1) * charge.CuryTranAmt;
                charge.Released    = false;
                charge.CashTranID  = null;
                this.Insert(charge);
            }
        }
Ejemplo n.º 4
0
 public void ReverseExpenses(ICADocument oldDoc, ICADocument newDoc)
 {
     ReverseCharges(oldDoc, newDoc, true);
 }