コード例 #1
0
        /// <summary>
        /// Get Checks
        /// </summary>
        /// <param name="PaymentRule">Payment Rule</param>
        /// <returns> true if payments were created</returns>
        private bool GetChecks(Ctx ctx, String PaymentRule, int C_PaySelection_ID, int startDocumentNo)
        {
            log.Config("C_PaySelection_ID=" + C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo);
            //
            //this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            //	get Selections

            bool result = false;

            m_checks = VAdvantage.Model.MPaySelectionCheck.Get(C_PaySelection_ID, PaymentRule, startDocumentNo, null);

            //this.setCursor(Cursor.getDefaultCursor());
            //
            if (m_checks == null || m_checks.Length == 0)
            {
                // ShowMessage.Error("VPayPrintNoRecords", null, "(" + Msg.Translate(ctx, "C_PaySelectionLine_ID") + " #0");
                result = false;
                //return false;
            }
            else
            {
                result = true;
            }
            m_batch = VAdvantage.Model.MPaymentBatch.GetForPaySelection(ctx, C_PaySelection_ID, null);
            //return true;


            return(true);
        }
コード例 #2
0
        public JsonResult VPayPrintSuccess(string[] data)
        {
            Ctx        ctx      = Session["ctx"] as Ctx;
            List <int> check_ID = JsonConvert.DeserializeObject <List <int> >(data[0]);

            VAdvantage.Model.MPaymentBatch             m_batch  = new VAdvantage.Model.MPaymentBatch(ctx, Util.GetValueOfInt(data[1]), null);
            VAdvantage.Model.MPaySelectionCheck[]      m_checks = null;
            List <VAdvantage.Model.MPaySelectionCheck> list     = new List <VAdvantage.Model.MPaySelectionCheck>();

            for (int i = 0; i < check_ID.Count; i++)
            {
                list.Add(new VAdvantage.Model.MPaySelectionCheck(ctx, check_ID[i], null));
            }
            m_checks = list.ToArray();
            VPayPrintModel objVPaySelect = new VPayPrintModel();

            return(Json(JsonConvert.SerializeObject(objVPaySelect.VPayPrintSuccess(ctx, m_checks, m_batch)), JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public JsonResult ContinueCheckPrint(string[] data)
        {
            Ctx        ctx = Session["ctx"] as Ctx;
            string     paymentMethod_ID   = Util.GetValueOfString(data[0]);
            int        C_PaySelection_ID  = Util.GetValueOfInt(data[1]);
            int        m_C_BankAccount_ID = Util.GetValueOfInt(data[2]);
            string     PaymentRule        = Util.GetValueOfString(data[3]);
            string     checkNo            = Util.GetValueOfString(data[4]);
            List <int> check_ID           = JsonConvert.DeserializeObject <List <int> >(data[5]);

            VAdvantage.Model.MPaymentBatch             m_batch  = new VAdvantage.Model.MPaymentBatch(ctx, Util.GetValueOfInt(data[6]), null);
            VAdvantage.Model.MPaySelectionCheck[]      m_checks = null;
            List <VAdvantage.Model.MPaySelectionCheck> list     = new List <VAdvantage.Model.MPaySelectionCheck>();

            for (int i = 0; i < check_ID.Count; i++)
            {
                list.Add(new VAdvantage.Model.MPaySelectionCheck(ctx, check_ID[i], null));
            }
            m_checks = list.ToArray();
            VPayPrintModel objVPaySelect = new VPayPrintModel();

            return(Json(JsonConvert.SerializeObject(objVPaySelect.ContinueCheckPrint(ctx, C_PaySelection_ID, m_C_BankAccount_ID, paymentMethod_ID, checkNo, check_ID, m_checks, m_batch)), JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
 public string VPayPrintSuccess(Ctx ctx, VAdvantage.Model.MPaySelectionCheck[] m_checks, VAdvantage.Model.MPaymentBatch m_batch)
 {
     if (true)
     {
         VAdvantage.Model.MPaySelectionCheck.ConfirmPrint(m_checks, m_batch);
     }
     else
     {
         //foreach (VAdvantage.Model.MPaySelectionCheck check in m_checks)
         //{
         //    check.SetCheckNo(oldCheckValues[check]);
         //    check.Save();
         //}
     }
     return("");
 }
コード例 #5
0
        public Cmd_Export Cmd_Export(Ctx ctx, int C_PaySelection_ID, int m_C_BankAccount_ID, string PaymentRule, int startDocumentNo)
        {
            Cmd_Export objCmdExport = new Cmd_Export();
            bool       res          = false;

            log.Info(PaymentRule);
            log.Config("C_PaySelection_ID=" + C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo);

            string expFile = "Export.txt";


            m_checks = VAdvantage.Model.MPaySelectionCheck.Get(C_PaySelection_ID, PaymentRule, startDocumentNo, null);

            //
            if (m_checks == null || m_checks.Length == 0)
            {
                // ShowMessage.Error("VPayPrintNoRecords", null, "(" + Msg.Translate(Envs.GetCtx(), "C_PaySelectionLine_ID") + " #0");
                res = false;
                //return false;
            }
            else
            {
                res = true;
            }
            m_batch = VAdvantage.Model.MPaymentBatch.GetForPaySelection(ctx, C_PaySelection_ID, null);
            //return true;
            if (!res)
            {
                return(null);
            }
            //  Get File Info
            Dictionary <VAdvantage.Model.MPaySelectionCheck, String> oldCheckValues = new Dictionary <VAdvantage.Model.MPaySelectionCheck, string>();

            //  Create File
            List <int> check_ID = new List <int>();

            foreach (VAdvantage.Model.MPaySelectionCheck check in m_checks)
            {
                //oldCheckValues.put(check,(String)check.get_ValueOld("DocumentNo"));
                oldCheckValues.Add(check, Util.GetValueOfString(check.Get_ValueOld("DocumentNo")));
                check_ID.Add(Util.GetValueOfInt(check.Get_ID()));
            }

            List <String[]> busPart    = new List <String[]>();
            List <String[]> bankAcc    = new List <String[]>();
            List <String>   comm       = new List <String>();
            List <String>   DocumentNo = new List <String>();
            List <String>   PayDate    = new List <String>();
            List <String>   ISOCode    = new List <String>();
            List <String>   PayAmt     = new List <String>();

            ////  write lines
            for (int i = 0; i < m_checks.Length; i++)
            {
                VAdvantage.Model.MPaySelectionCheck mpp = m_checks[i];
                if (mpp == null)
                {
                    continue;
                }
                //  BPartner Info
                bp = GetBPartnerInfo(mpp.GetC_BPartner_ID());
                busPart.Add(bp);
                //  TarGet BankAccount Info
                bpba = GetBPBankAccountInfo(mpp.GetC_BP_BankAccount_ID());
                bankAcc.Add(bpba);
                //  Comment - list of invoice document no
                StringBuilder comment = new StringBuilder();
                VAdvantage.Model.MPaySelectionLine[] psls = mpp.GetPaySelectionLines(false);
                for (int l = 0; l < psls.Length; l++)
                {
                    if (l > 0)
                    {
                        comment.Append(", ");
                    }
                    comment.Append(psls[l].GetInvoice().GetDocumentNo());
                }
                comm.Add(comment.ToString());
                DocumentNo.Add(mpp.GetDocumentNo());
                PayDate.Add(mpp.GetParent().GetPayDate().ToString());
                ISOCode.Add(VAdvantage.Model.MCurrency.GetISO_Code(ctx, mpp.GetParent().GetC_Currency_ID()));
                PayAmt.Add(mpp.GetPayAmt().ToString());
            }


            string filepath = Export(m_checks, expFile, comm, busPart, bankAcc, DocumentNo, PayDate, ISOCode, PayAmt);

            objCmdExport.check_ID = check_ID;
            objCmdExport.m_batch  = m_batch.GetC_PaymentBatch_ID();
            objCmdExport.filepath = filepath;
            return(objCmdExport);
        }
コード例 #6
0
        /// <summary>
        /// ContinueCheckPrint
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="C_PaySelection_ID"></param>
        /// <param name="m_C_BankAccount_ID"></param>
        /// <param name="PaymentRule"></param>
        /// <param name="startDocumentNo"></param>
        /// <param name="check_ID"></param>
        /// <param name="m_checks"></param>
        /// <param name="m_batch"></param>
        /// <returns></returns>
        public List <int> ContinueCheckPrint(Ctx ctx, int C_PaySelection_ID, int m_C_BankAccount_ID, string PaymentRule, string startDocumentNo, List <int> check_ID,
                                             VAdvantage.Model.MPaySelectionCheck[] m_checks, VAdvantage.Model.MPaymentBatch m_batch)
        {
            int    c_payment_ID = 0;
            string sql          = string.Empty;
            // int lastDocumentNo = MPaySelectionCheck.ConfirmPrint(m_checks, m_batch);
            int lastDocumentNo = VAdvantage.Model.MPaySelectionCheck.ConfirmPrint(m_checks, m_batch);

            if (lastDocumentNo != 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("UPDATE C_BankAccountDoc SET CurrentNext= " + (++lastDocumentNo))
                .Append(" WHERE C_BankAccount_ID= " + m_C_BankAccount_ID)
                .Append(" AND PaymentRule=  '" + PaymentRule + "'");

                int result = DB.ExecuteQuery(sb.ToString());
            }

            payment_ID = new List <int>();
            for (int k = 0; k < check_ID.Count; k++)
            {
                sql          = "select c_payment_id from c_PaySelectionCheck where c_PaySelectionCheck_id = " + Util.GetValueOfInt(check_ID[k]);
                c_payment_ID = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, null));
                payment_ID.Add(c_payment_ID);
            }


            return(payment_ID);
        }
コード例 #7
0
        /// <summary>
        /// Print Checks and/or Remittance
        /// </summary>
        public Cmd_Print Cmd_Print(Ctx ctx, int C_PaySelection_ID, int m_C_BankAccount_ID, string PaymentRule, int startDocumentNo)
        {
            Cmd_Print objCmdPrint = new Cmd_Print();

            VAdvantage.ProcessEngine.ProcessCtl pctrl = null;
            bool res = false;

            log.Info(PaymentRule);


            log.Config("C_PaySelection_ID=" + C_PaySelection_ID + ", PaymentRule=" + PaymentRule + ", DocumentNo=" + startDocumentNo);


            m_checks = VAdvantage.Model.MPaySelectionCheck.Get(C_PaySelection_ID, PaymentRule, startDocumentNo, null);

            if (m_checks == null || m_checks.Length == 0)
            {
                //ShowMessage.Error("VPayPrintNoRecords", null, "(" + Msg.Translate(Envs.GetCtx(), "C_PaySelectionLine_ID") + " #0");
                res = false;
                //return false;
            }
            else
            {
                res = true;
            }
            m_batch = VAdvantage.Model.MPaymentBatch.GetForPaySelection(ctx, C_PaySelection_ID, null);
            if (!m_batch.Save())
            {
            }
            //return true;
            if (!res)
            {
                return(null);
            }

            bool somethingPrinted = false;
            bool directPrint      = !Ini.IsPropertyBool(Ini.P_PRINTPREVIEW);
            Dictionary <VAdvantage.Model.MPaySelectionCheck, String> oldCheckValues = new Dictionary <VAdvantage.Model.MPaySelectionCheck, string>();
            int        checkID      = 0;
            int        c_payment_ID = 0;
            List <int> check_ID     = new List <int>();

            foreach (VAdvantage.Model.MPaySelectionCheck check in m_checks)
            {
                //	ReportCtrl will check BankAccountDoc for PrintFormat
                oldCheckValues.Add(check, Util.GetValueOfString(check.Get_ValueOld("CheckNo")));
                check.Save();
                checkID = Util.GetValueOfInt(check.Get_ID());
                check_ID.Add(checkID);
                if (!somethingPrinted)
                {
                    somethingPrinted = true;
                }
            }

            int    table_ID             = 0;
            int    AD_Process_ID        = 0;
            string sql                  = "";
            int    paymentTable_ID      = 0;
            int    paymentAD_Process_ID = 0;

            try
            {
                sql      = "select ad_table_id from ad_table where tablename = 'C_PaySelectionCheck'";
                table_ID = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, null));

                //sql = "select ad_process_id from ad_process where value = 'CheckPrint'";
                sql           = "select ad_process_id from ad_process where ad_printformat_id = (select check_printformat_id from c_bankaccountdoc where c_bankaccount_id = (select c_bankaccount_id from c_payment where c_payment_id = (select c_payment_id from c_payselectioncheck where c_payselectioncheck_id = " + checkID + ")) and c_bankaccountdoc.isactive = 'Y' and rownum =1)";
                AD_Process_ID = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, null));

                sql             = "select ad_table_id from ad_table where tablename = 'C_Payment'";
                paymentTable_ID = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, null));

                sql = "select ad_process_id from ad_process where value = 'PaymentPrintFormat'";
                paymentAD_Process_ID = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, null));
                // int paymentAD_Process_ID = 313;
            }
            catch
            {
            }

            //for (int j = 0; j < check_ID.Count; j++)
            //{

            //    int record_ID = Util.GetValueOfInt(checkID);
            //  VAdvantage.ProcessEngine.ProcessInfo pi = new VAdvantage.ProcessEngine.ProcessInfo(null, AD_Process_ID, table_ID, Util.GetValueOfInt(check_ID[j]));
            //    pi.SetAD_User_ID(ctx.GetAD_User_ID());
            //    pi.SetAD_Client_ID(ctx.GetAD_Client_ID());
            //    byte[] reportData = null;
            //    string result="";
            //    pctrl = new VAdvantage.ProcessEngine.ProcessCtl(ctx,null, pi, null);
            //    pctrl.Process(pi, ctx,out reportData,out result);

            //}
            objCmdPrint.check_ID = check_ID;
            objCmdPrint.m_batch  = m_batch.GetC_PaymentBatch_ID();
            return(objCmdPrint);
        }