add print file voucher

This commit is contained in:
2022-11-07 08:44:33 +01:00
parent 5933cd8370
commit a3b567d510
2 changed files with 42 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import com.axelor.apps.account.db.Invoice;
import com.axelor.apps.account.db.InvoicePayment; import com.axelor.apps.account.db.InvoicePayment;
import com.axelor.apps.account.db.PaymentCondition; import com.axelor.apps.account.db.PaymentCondition;
import com.axelor.apps.account.db.PaymentMode; import com.axelor.apps.account.db.PaymentMode;
import com.axelor.apps.account.db.PaymentVoucher;
import com.axelor.apps.account.db.repo.InvoiceRepository; import com.axelor.apps.account.db.repo.InvoiceRepository;
import com.axelor.apps.account.exception.IExceptionMessage; import com.axelor.apps.account.exception.IExceptionMessage;
import com.axelor.apps.account.service.AccountingSituationService; import com.axelor.apps.account.service.AccountingSituationService;
@@ -987,4 +988,30 @@ public class InvoiceController {
response.setView(ActionView.define(name).add("html", fileLink).map()); response.setView(ActionView.define(name).add("html", fileLink).map());
} }
public void printPaymentFile(ActionRequest request, ActionResponse response)
throws AxelorException {
PaymentVoucher paymentVoucher = request.getContext().asType(PaymentVoucher.class);
String name = I18n.get("Payment voucher");
String AmountToPay = paymentVoucher.getPaidAmount().toString();
String[] arrOfStr = AmountToPay.split("\\.");
String left = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[0]));
String right = Beans.get(ConvertNumberToFrenchWordsService.class).convert(Long.parseLong(arrOfStr[1]));
String number = left+" dinars algériens et "+right+" centimes";
String fileLink =
ReportFactory.createReport("PaymentRequest.rptdesign", name + "-${date}")
.addParam("PaymentVoucherId", paymentVoucher.getId())
.addParam("NumberToWords", number)
.generate()
.getFileLink();
logger.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
}
} }

View File

@@ -59,6 +59,21 @@
<string name="chequeOwner" /> <string name="chequeOwner" />
<date name="chequeDate" title="Bank deposit date" /> <date name="chequeDate" title="Bank deposit date" />
<many-to-one name="depositSlip" ref="com.axelor.apps.account.db.DepositSlip" /> <many-to-one name="depositSlip" ref="com.axelor.apps.account.db.DepositSlip" />
<string name="label" />
<many-to-one name="confirmedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Confirmed by"/>
<date name="confirmationDate" title="Confirmation date" readonly="true"/>
<many-to-one name="acceptedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Accepted by"/>
<date name="acceptanceDate" title="acceptance date" readonly="true"/>
<many-to-one name="requestedByUser" ref="com.axelor.auth.db.User" readonly="true" title="requested by"/>
<date name="requestDate" title="request Date" />
<many-to-one name="recipientUser" ref="com.axelor.auth.db.User" readonly="true" title="recipient"/>
<unique-constraint columns="ref,company"/> <unique-constraint columns="ref,company"/>
<unique-constraint columns="receiptNo,company"/> <unique-constraint columns="receiptNo,company"/>