コード例 #1
0
ファイル: MOrderLine.java プロジェクト: metasfresh/metasfresh
  /**
   * Recalculate order tax
   *
   * @param oldTax true if the old C_Tax_ID should be used
   * @return true if success, false otherwise
   * @author teo_sarca [ 1583825 ]
   */
  private boolean updateOrderTax(final boolean oldTax) {
    // NOTE: keep in sync with org.compiere.model.MInvoiceLine.updateInvoiceTax(boolean)

    final String trxName = get_TrxName();
    final int taxPrecision = getPrecision();
    final MOrderTax tax = MOrderTax.get(this, taxPrecision, oldTax, trxName);
    if (tax == null) {
      return true;
    }

    if (!tax.calculateTaxFromLines()) {
      return false;
    }

    //
    // If tax has invoice lines behind => fine, save it
    if (tax.isActive()) {
      InterfaceWrapperHelper.save(tax, trxName);
    }
    // Tax has no longer any invoice lines behind => deleted it if it's not new
    else {
      if (!InterfaceWrapperHelper.isNew(tax)) {
        InterfaceWrapperHelper.delete(tax);
      }
    }

    return true;
  }
コード例 #2
0
  @Override
  public I_M_DeliveryDay_Alloc getCreateDeliveryDayAlloc(
      final IContextAware context, final IDeliveryDayAllocable model) {
    final IDeliveryDayDAO deliveryDayDAO = Services.get(IDeliveryDayDAO.class);

    final PlainDeliveryDayQueryParams deliveryDayMatchingParams =
        createDeliveryDayQueryParams(model);

    //
    //
    I_M_DeliveryDay_Alloc deliveryDayAlloc =
        deliveryDayDAO.retrieveDeliveryDayAllocForModel(context, model);
    if (deliveryDayAlloc != null) {
      final I_M_DeliveryDay deliveryDayCurrent = deliveryDayAlloc.getM_DeliveryDay();

      if (!deliveryDayDAO.isDeliveryDayMatches(deliveryDayCurrent, deliveryDayMatchingParams)) {
        // Delivery Date is not matching anymore => we need to destroy this allocation
        InterfaceWrapperHelper.delete(deliveryDayAlloc);
        deliveryDayAlloc = null;
      }
    }

    //
    // Create a new Delivery Day Allocation if we don't have one yet
    // ... and get the the Delivery Day record
    if (deliveryDayAlloc == null) {
      deliveryDayMatchingParams.setProcessed(false); // only not processed delivery days
      final I_M_DeliveryDay deliveryDay =
          deliveryDayDAO.retrieveDeliveryDay(context, deliveryDayMatchingParams);
      if (deliveryDay != null) {
        deliveryDayAlloc = createDeliveryDayAlloc(context, deliveryDay, model);
      }
    }

    return deliveryDayAlloc;
  }
コード例 #3
0
 @Override
 public void delete(final I_M_HU_Attribute huAttribute) {
   InterfaceWrapperHelper.delete(huAttribute);
 }