コード例 #1
0
 protected boolean hasSalesTaxBeenEntered(
     AccountingLine accountingLine, boolean source, boolean newLine, int index) {
   boolean entered = true;
   String objCd = accountingLine.getFinancialObjectCode();
   String account = accountingLine.getAccountNumber();
   SalesTax salesTax = accountingLine.getSalesTax();
   if (ObjectUtils.isNull(salesTax)) {
     return false;
   }
   if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
     entered &= false;
   }
   if (StringUtils.isBlank(salesTax.getAccountNumber())) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
     entered &= false;
   }
   if (salesTax.getFinancialDocumentSaleDate() == null) {
     entered &= false;
   }
   return entered;
 }
コード例 #2
0
  /**
   * This method checks to see if the sales tax information was put into the accounting line
   *
   * @param accountingLine
   * @return true if entered correctly, false otherwise
   */
  protected boolean isValidSalesTaxEntered(
      AccountingLine accountingLine, boolean source, boolean newLine, int index) {
    boolean valid = true;
    DictionaryValidationService dictionaryValidationService =
        SpringContext.getBean(DictionaryValidationService.class);
    BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
    String objCd = accountingLine.getFinancialObjectCode();
    String account = accountingLine.getAccountNumber();
    SalesTax salesTax = accountingLine.getSalesTax();
    String pathPrefix = "";
    if (source && !newLine) {
      pathPrefix =
          "document." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
    } else if (!source && !newLine) {
      pathPrefix =
          "document." + KFSConstants.EXISTING_TARGET_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
    } else if (source && newLine) {
      pathPrefix = KFSConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME;
    } else if (!source && newLine) {
      pathPrefix = KFSConstants.NEW_TARGET_ACCT_LINE_PROPERTY_NAME;
    }
    GlobalVariables.getMessageMap().addToErrorPath(pathPrefix);
    if (ObjectUtils.isNull(salesTax)) {
      valid &= false;
      GlobalVariables.getMessageMap()
          .putError(
              "salesTax.chartOfAccountsCode",
              ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED,
              account,
              objCd);
    } else {

      if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
        valid &= false;
        GlobalVariables.getMessageMap()
            .putError("salesTax.chartOfAccountsCode", ERROR_REQUIRED, "Chart of Accounts");
      }
      if (StringUtils.isBlank(salesTax.getAccountNumber())) {
        valid &= false;
        GlobalVariables.getMessageMap()
            .putError("salesTax.accountNumber", ERROR_REQUIRED, "Account Number");
      }
      if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
        valid &= false;
        GlobalVariables.getMessageMap()
            .putError(
                "salesTax.financialDocumentGrossSalesAmount", ERROR_REQUIRED, "Gross Sales Amount");
      }
      if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
        valid &= false;
        GlobalVariables.getMessageMap()
            .putError(
                "salesTax.financialDocumentTaxableSalesAmount",
                ERROR_REQUIRED,
                "Taxable Sales Amount");
      }
      if (salesTax.getFinancialDocumentSaleDate() == null) {
        valid &= false;
        GlobalVariables.getMessageMap()
            .putError("salesTax.financialDocumentSaleDate", ERROR_REQUIRED, "Sale Date");
      }
      if (StringUtils.isNotBlank(salesTax.getChartOfAccountsCode())
          && StringUtils.isNotBlank(salesTax.getAccountNumber())) {

        if (boService.getReferenceIfExists(salesTax, "account") == null) {
          valid &= false;
          GlobalVariables.getMessageMap()
              .putError(
                  "salesTax.accountNumber",
                  ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_INVALID_ACCOUNT,
                  salesTax.getChartOfAccountsCode(),
                  salesTax.getAccountNumber());
        }
      }
      if (!valid) {
        GlobalVariables.getMessageMap()
            .putError(
                "salesTax.chartOfAccountsCode",
                ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED,
                account,
                objCd);
      }
    }
    GlobalVariables.getMessageMap().removeFromErrorPath(pathPrefix);
    return valid;
  }