public static CATran DefaultValues(PXCache sender, CATran catran_Row, CADepositDetail orig_Row)
        {
            CADepositDetail parentDoc = orig_Row;
            CADeposit       deposit   = PXSelect <CADeposit, Where <CADeposit.tranType, Equal <Required <CADeposit.tranType> >,
                                                                    And <CADeposit.refNbr, Equal <Required <CADeposit.refNbr> > > > > .Select(sender.Graph, parentDoc.TranType, parentDoc.RefNbr);

            if ((parentDoc.Released == true) && (catran_Row.TranID != null) ||
                parentDoc.CuryTranAmt == null ||
                parentDoc.CuryTranAmt == 0)
            {
                return(null);
            }

            catran_Row.OrigModule   = BatchModule.CA;
            catran_Row.OrigTranType = parentDoc.TranType;
            catran_Row.OrigRefNbr   = parentDoc.RefNbr;

            catran_Row.CashAccountID = parentDoc.AccountID;

            catran_Row.CuryID      = parentDoc.OrigCuryID;
            catran_Row.CuryInfoID  = parentDoc.CuryInfoID;
            catran_Row.CuryTranAmt = parentDoc.CuryOrigAmtSigned * (parentDoc.DrCr == CADrCr.CADebit ? 1 : -1);
            catran_Row.TranAmt     = parentDoc.OrigAmtSigned * (parentDoc.DrCr == CADrCr.CADebit ? 1 : -1);
            catran_Row.DrCr        = parentDoc.DrCr;
            catran_Row.TranDesc    = parentDoc.TranDesc;
            catran_Row.ReferenceID = null;
            catran_Row.Released    = parentDoc.Released;
            if (parentDoc.DetailType == CADepositDetailType.CheckDeposit || parentDoc.DetailType == CADepositDetailType.VoidCheckDeposit)
            {
                catran_Row.TranDesc = string.Format("{0}-{1}", parentDoc.OrigDocType, parentDoc.OrigRefNbr);
            }
            if (deposit != null)
            {
                catran_Row.Hold         = deposit.Hold;
                catran_Row.FinPeriodID  = deposit.FinPeriodID;
                catran_Row.TranPeriodID = deposit.TranPeriodID;
                catran_Row.ExtRefNbr    = deposit.ExtRefNbr;
                catran_Row.TranDate     = deposit.TranDate;
                catran_Row.Cleared      = deposit.Cleared;
                catran_Row.ClearDate    = deposit.ClearDate;
            }
            if (parentDoc.DetailType == CADepositDetailType.VoidCheckDeposit)
            {
                CADepositDetail voidedDoc = PXSelectReadonly <CADepositDetail, Where <CADepositDetail.refNbr, Equal <Required <CADepositDetail.refNbr> >,
                                                                                      And <CADepositDetail.tranType, Equal <Required <CADepositDetail.tranType> >,
                                                                                           And <CADepositDetail.lineNbr, Equal <Required <CADepositDetail.lineNbr> > > > > > .Select(sender.Graph, parentDoc.RefNbr, CATranType.CADeposit, parentDoc.LineNbr);

                if (voidedDoc != null)
                {
                    catran_Row.VoidedTranID = voidedDoc.TranID;
                }
            }

            SetCleared(catran_Row, GetCashAccount(catran_Row, sender.Graph));

            return(catran_Row);
        }
Ejemplo n.º 2
0
        public static CATran DefaultValues(PXCache sender, CATran catran_Row, CADeposit parentDoc, string fieldName)
        {
            if ((parentDoc.Released == true) && (catran_Row.TranID != null) ||
                IsCreationNeeded(parentDoc) == false)
            {
                return(null);
            }

            catran_Row.OrigModule   = BatchModule.CA;
            catran_Row.OrigTranType = parentDoc.TranType;
            catran_Row.OrigRefNbr   = parentDoc.RefNbr;

            catran_Row.CashAccountID = parentDoc.ExtraCashAccountID;
            catran_Row.ExtRefNbr     = parentDoc.ExtRefNbr;
            catran_Row.CuryID        = parentDoc.CuryID;
            catran_Row.CuryInfoID    = parentDoc.CuryInfoID;
            catran_Row.DrCr          = parentDoc.DrCr == CADrCr.CADebit ? CADrCr.CACredit : CADrCr.CADebit;
            catran_Row.CuryTranAmt   = parentDoc.CuryExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1);
            catran_Row.TranAmt       = parentDoc.ExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1);

            catran_Row.TranDate     = parentDoc.TranDate;
            catran_Row.TranDesc     = parentDoc.TranDesc;
            catran_Row.ReferenceID  = null;
            catran_Row.Released     = parentDoc.Released;
            catran_Row.Hold         = parentDoc.Hold;
            catran_Row.FinPeriodID  = parentDoc.FinPeriodID;
            catran_Row.TranPeriodID = parentDoc.TranPeriodID;
            catran_Row.Cleared      = parentDoc.Cleared;
            catran_Row.ClearDate    = parentDoc.ClearDate;
            if (parentDoc.DocType == CATranType.CAVoidDeposit)
            {
                CADeposit voidedDoc = PXSelectReadonly <CADeposit, Where <CADeposit.refNbr, Equal <Required <CADeposit.refNbr> >,
                                                                          And <CADeposit.tranType, Equal <Required <CADeposit.tranType> > > > > .Select(sender.Graph, parentDoc.RefNbr, CATranType.CADeposit);

                if (voidedDoc != null)
                {
                    catran_Row.VoidedTranID = (long?)sender.GetValue(voidedDoc, fieldName);
                }
            }

            PXSelectBase <CashAccount> selectStatement = new PXSelectReadonly <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> > > >(sender.Graph);
            CashAccount cashacc = (CashAccount)selectStatement.View.SelectSingle(catran_Row.CashAccountID);

            if (cashacc != null && cashacc.Reconcile == false && (catran_Row.Cleared != true || catran_Row.TranDate == null))
            {
                catran_Row.Cleared   = true;
                catran_Row.ClearDate = catran_Row.TranDate;
            }
            return(catran_Row);
        }
Ejemplo n.º 3
0
        public static CATran DefaultValues(PXCache sender, CATran catran_Row, CADeposit parentDoc, string fieldName)
        {
            if ((parentDoc.Released == true) && (catran_Row.TranID != null) ||
                IsCreationNeeded(parentDoc) == false)
            {
                return(null);
            }

            catran_Row.OrigModule   = BatchModule.CA;
            catran_Row.OrigTranType = parentDoc.TranType;
            catran_Row.OrigRefNbr   = parentDoc.RefNbr;

            catran_Row.CashAccountID = parentDoc.ExtraCashAccountID;
            catran_Row.ExtRefNbr     = parentDoc.ExtRefNbr;
            catran_Row.CuryID        = parentDoc.CuryID;
            catran_Row.CuryInfoID    = parentDoc.CuryInfoID;
            catran_Row.DrCr          = parentDoc.DrCr == CADrCr.CADebit ? CADrCr.CACredit : CADrCr.CADebit;
            catran_Row.CuryTranAmt   = parentDoc.CuryExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1);
            catran_Row.TranAmt       = parentDoc.ExtraCashTotal * (catran_Row.DrCr == CADrCr.CADebit ? 1 : -1);

            catran_Row.TranDate    = parentDoc.TranDate;
            catran_Row.TranDesc    = parentDoc.TranDesc;
            catran_Row.ReferenceID = null;
            catran_Row.Released    = parentDoc.Released;
            catran_Row.Hold        = parentDoc.Hold;
            SetPeriodsByMaster(sender, catran_Row, parentDoc.TranPeriodID);
            catran_Row.Cleared   = parentDoc.Cleared;
            catran_Row.ClearDate = parentDoc.ClearDate;
            if (parentDoc.DocType == CATranType.CAVoidDeposit)
            {
                CADeposit voidedDoc = PXSelectReadonly <CADeposit, Where <CADeposit.refNbr, Equal <Required <CADeposit.refNbr> >,
                                                                          And <CADeposit.tranType, Equal <Required <CADeposit.tranType> > > > > .Select(sender.Graph, parentDoc.RefNbr, CATranType.CADeposit);

                if (voidedDoc != null)
                {
                    catran_Row.VoidedTranID = (long?)sender.GetValue(voidedDoc, fieldName);
                }
            }

            SetCleared(catran_Row, GetCashAccount(catran_Row, sender.Graph));

            return(catran_Row);
        }
Ejemplo n.º 4
0
 protected static bool IsCreationNeeded(CADeposit parentDoc)
 {
     return(!(parentDoc.ChargesSeparate != true || parentDoc.CuryChargeTotal == null ||
              parentDoc.CuryChargeTotal == 0));
 }
Ejemplo n.º 5
0
 protected static bool IsCreationNeeded(CADeposit parentDoc)
 {
     return(parentDoc.ExtraCashAccountID != null &&
            parentDoc.ExtraCashTotal != null &&
            parentDoc.ExtraCashTotal != decimal.Zero);
 }