add print file voucher
This commit is contained in:
@@ -22,6 +22,7 @@ import com.axelor.apps.account.db.Invoice;
|
||||
import com.axelor.apps.account.db.InvoicePayment;
|
||||
import com.axelor.apps.account.db.PaymentCondition;
|
||||
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.exception.IExceptionMessage;
|
||||
import com.axelor.apps.account.service.AccountingSituationService;
|
||||
@@ -987,4 +988,30 @@ public class InvoiceController {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,21 @@
|
||||
<date name="chequeDate" title="Bank deposit date" />
|
||||
<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="receiptNo,company"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user