/// <summary> /// VPayPrintRemittance /// </summary> /// <param name="ctx"></param> /// <param name="payment_ID"></param> /// <returns></returns> public string VPayPrintRemittance(Ctx ctx, List <int> payment_ID) { int table_ID = 0; int AD_Process_ID = 0; string sql = ""; int paymentTable_ID = 0; int paymentAD_Process_ID = 0; VAdvantage.ProcessEngine.ProcessCtl pctrl = null; try { 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)); } catch { } //for (int l = 0; l < payment_ID.Count; l++) //{ // byte[] reportData = null; // string result = ""; // VAdvantage.ProcessEngine.ProcessInfo pin = new VAdvantage.ProcessEngine.ProcessInfo(null, paymentAD_Process_ID, paymentTable_ID, Util.GetValueOfInt(payment_ID[l])); // pin.SetAD_User_ID(ctx.GetAD_User_ID()); // pin.SetAD_Client_ID(ctx.GetAD_Client_ID()); // pctrl = new VAdvantage.ProcessEngine.ProcessCtl(ctx,null, pin, null); // pctrl.Process(pin, ctx,out reportData, out result); //} return(""); }
/// <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); }