Search in sources :

Example 1 with LAR_TaxPayerType

use of ar.com.ergio.model.LAR_TaxPayerType in project lar_361 by comitsrl.

the class FiscalDocumentPrint method getCustomer.

/**
 * Crea un <code>Customer</code> a partir de una entidad comercial.
 * @param bPartnerID ID de la entidad comercial.
 * @return el cliente correspondiente.
 */
public Customer getCustomer(int bPartnerID) {
    // TODO - Review this implementation
    MBPartner bPartner = new MBPartner(Env.getCtx(), bPartnerID, getTrxName());
    Customer customer = new Customer();
    if (bPartner != null) {
        // Se asigna la categoría de iva del cliente.
        LAR_TaxPayerType taxPayerType = LAR_TaxPayerType.getTaxPayerType(bPartner);
        customer.setIvaResponsibility(traduceTaxPayerType(taxPayerType.getName()));
        // TODO - Parametrize this method
        MInvoice mInvoice = (MInvoice) getOxpDocument();
        // Se asigna el nombre del cliente a partir del BPartner.
        customer.setName(bPartner.getName());
        // Se asigna el domicilio.
        MLocation location = MLocation.getBPLocation(Env.getCtx(), mInvoice.getC_BPartner_Location_ID(), getTrxName());
        customer.setLocation(location.toString());
        // Bpartner.
        if (bPartner.getTaxID() != null && !bPartner.getTaxID().trim().equals("")) {
            customer.setIdentificationType(Customer.CUIT);
            customer.setIdentificationNumber(bPartner.getTaxID());
        }
    }
    return customer;
}
Also used : Customer(ar.com.ergio.print.fiscal.document.Customer) MInvoice(org.compiere.model.MInvoice) MBPartner(org.compiere.model.MBPartner) LAR_TaxPayerType(ar.com.ergio.model.LAR_TaxPayerType) MLocation(org.compiere.model.MLocation)

Example 2 with LAR_TaxPayerType

use of ar.com.ergio.model.LAR_TaxPayerType in project lar_361 by comitsrl.

the class FiscalDocumentPrint method createDNFH.

private DNFH createDNFH(final MInOut shipment) {
    final DNFH dnfh = new DNFH();
    // Se asigna el cliente.
    Customer customer = null;
    final MBPartner bPartner = new MBPartner(Env.getCtx(), shipment.getC_BPartner_ID(), null);
    if (bPartner != null) {
        customer = new Customer();
        // Se asigna la categoría de iva del cliente.
        LAR_TaxPayerType taxPayerType = LAR_TaxPayerType.getTaxPayerType(bPartner);
        customer.setIvaResponsibility(traduceTaxPayerType(taxPayerType.getName()));
        // Se asigna el nombre del cliente a partir del BPartner.
        customer.setName(bPartner.getName());
        // Se asigna el domicilio.
        final MLocation location = MLocation.getBPLocation(Env.getCtx(), shipment.getC_BPartner_Location_ID(), getTrxName());
        customer.setLocation(location.toString());
        // Se identifica al cliente con el C.U.I.T. configurado en el Bpartner.
        if (bPartner.getTaxID() != null && !bPartner.getTaxID().trim().equals("")) {
            customer.setIdentificationType(Customer.CUIT);
            customer.setIdentificationNumber(bPartner.getTaxID());
        }
    }
    dnfh.setCustomer(customer);
    // Recupera el numero de copias a imprimir
    int numberOfCopies = MSysConfig.getIntValue("LAR_Remitos_NumeroDeCopias", 0, Env.getAD_Client_ID(shipment.getCtx()));
    dnfh.setNumberOfCopies(numberOfCopies);
    // Cargar las lineas del remito
    loadDNFHLines(shipment, dnfh);
    return dnfh;
}
Also used : Customer(ar.com.ergio.print.fiscal.document.Customer) MBPartner(org.compiere.model.MBPartner) DNFH(ar.com.ergio.print.fiscal.document.DNFH) LAR_TaxPayerType(ar.com.ergio.model.LAR_TaxPayerType) MLocation(org.compiere.model.MLocation)

Aggregations

LAR_TaxPayerType (ar.com.ergio.model.LAR_TaxPayerType)2 Customer (ar.com.ergio.print.fiscal.document.Customer)2 MBPartner (org.compiere.model.MBPartner)2 MLocation (org.compiere.model.MLocation)2 DNFH (ar.com.ergio.print.fiscal.document.DNFH)1 MInvoice (org.compiere.model.MInvoice)1