예제 #1
0
 /**
  * Get MBank from Cache
  *
  * @param ctx context
  * @param C_Bank_ID id
  * @return MBank
  */
 public static MBank get(Properties ctx, int C_Bank_ID) {
   Integer key = new Integer(C_Bank_ID);
   MBank retValue = (MBank) s_cache.get(key);
   if (retValue != null) return retValue;
   retValue = new MBank(ctx, C_Bank_ID, null);
   if (retValue.get_ID() != 0) s_cache.put(key, retValue);
   return retValue;
 } //	get
예제 #2
0
  public void loadStartData() {
    String whereClause = "DocBaseType = ? ";
    doctypes =
        new Query(ctx, MDocType.Table_Name, whereClause, null)
            .setParameters("APP")
            .setClient_ID()
            .setOnlyActiveRecords(true)
            .list();

    sequence =
        new Query(ctx, MSequence.Table_Name, "Name = 'FCAQPayment'", null)
            .setClient_ID()
            .setOnlyActiveRecords(true)
            .first();

    paymentTypes =
        new Query(ctx, MRefList.Table_Name, "AD_Reference_ID=?", null)
            .setOnlyActiveRecords(true)
            .setParameters(214)
            .list();

    cardTypes =
        new Query(ctx, MRefList.Table_Name, "AD_Reference_ID=?", null)
            .setOnlyActiveRecords(true)
            .setParameters(149)
            .list();

    bankAccounts =
        new Query(ctx, MBankAccount.Table_Name, "", null)
            .setClient_ID()
            .setOnlyActiveRecords(true)
            .list();

    bankbox =
        new Query(ctx, MBank.Table_Name, "SwiftCode=?", null)
            .setOnlyActiveRecords(true)
            .setParameters("C")
            .first();

    bankdiners =
        new Query(ctx, MBank.Table_Name, "SwiftCode=?", null)
            .setOnlyActiveRecords(true)
            .setParameters("D")
            .first();

    bankvisa =
        new Query(ctx, MBank.Table_Name, "SwiftCode=?", null)
            .setOnlyActiveRecords(true)
            .setParameters("V")
            .first();

    if (bankbox != null) {
      List<MBankAccount> cashboxes =
          new Query(ctx, MBankAccount.Table_Name, "C_Bank_ID=? AND SalesRep_ID=?", null)
              .setParameters(bankbox.get_ID(), Env.getContext(ctx, "#AD_User_ID"))
              .setOnlyActiveRecords(true)
              .list();

      if (cashboxes.size() > 1) {
        showErrorMessage("Existen mas de 2 cajas asignadas a este usuario");
      } else if (cashboxes.size() == 0) {
        showErrorMessage("Este Usuario no tiene ninguna caja asignada");
      } else {
        cashbox = cashboxes.get(0);
      }
    }
  }