Examples of MPrintFormat


Examples of org.compiere.print.MPrintFormat

      }
    }
    sql.append(" ORDER BY i.C_Invoice_ID, pf.AD_Org_ID DESC")//  more than 1 PF record
    log.fine(sql.toString());

    MPrintFormat format = null;
    int old_AD_PrintFormat_ID = -1;
    int old_C_Invoice_ID = -1;
    int C_BPartner_ID = 0;
    int count = 0;
    int errors = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
   
    try
    {
      pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
      pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx()));
      pstmt.setInt(2, Env.getAD_Org_ID(Env.getCtx()));
      rs = pstmt.executeQuery();
     
      while (rs.next())
      {
        int C_Invoice_ID = rs.getInt(1);
        if (C_Invoice_ID == old_C_Invoice_ID//  multiple pf records
          continue;
        old_C_Invoice_ID = C_Invoice_ID;
        //  Set Language when enabled
        Language language = Language.getLoginLanguage();    //  Base Language
        String AD_Language = rs.getString(2);
        if (AD_Language != null && "Y".equals(rs.getString(3)))
          language = Language.getLanguage(AD_Language);
        //
        int AD_PrintFormat_ID = rs.getInt(4);
        int copies = rs.getInt(5);
        if (copies == 0)
          copies = 1;
        int AD_User_ID = rs.getInt(6);
        MUser to = new MUser (getCtx(), AD_User_ID, get_TrxName());
        String DocumentNo = rs.getString(7);
        C_BPartner_ID = rs.getInt(8);
        //
        String documentDir = client.getDocumentDir();
        if (documentDir == null || documentDir.length() == 0)
          documentDir = ".";
        //
        if (p_EMailPDF && (to.get_ID() == 0 || to.getEMail() == null || to.getEMail().length() == 0))
        {
          addLog (C_Invoice_ID, null, null, DocumentNo + " @RequestActionEMailNoTo@");
          errors++;
          continue;
        }
        if (AD_PrintFormat_ID == 0)
        {
          addLog (C_Invoice_ID, null, null, DocumentNo + " No Print Format");
          errors++;
          continue;
        }
        //  Get Format & Data
        if (AD_PrintFormat_ID != old_AD_PrintFormat_ID)
        {
          format = MPrintFormat.get (getCtx(), AD_PrintFormat_ID, false);
          old_AD_PrintFormat_ID = AD_PrintFormat_ID;
        }
        format.setLanguage(language);
        format.setTranslationLanguage(language);
        //  query
        MQuery query = new MQuery("C_Invoice_Header_v");
        query.addRestriction("C_Invoice_ID", MQuery.EQUAL, new Integer(C_Invoice_ID));

        //  Engine
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.