mirror of https://github.com/jeecgboot/jeecg-boot
feat: show/hide balance in credit invoice + fix
parent
b758674801
commit
03e5b1cc9d
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||
public class CreditInvoice extends AbstractInvoice<String, Object, Integer, Object, BigDecimal> {
|
||||
|
||||
private final BigDecimal balance;
|
||||
@Getter
|
||||
private final Credit credit;
|
||||
@Getter
|
||||
private final String currency;
|
||||
|
@ -46,14 +47,16 @@ public class CreditInvoice extends AbstractInvoice<String, Object, Integer, Obje
|
|||
cellStyle.setFont(arial);
|
||||
cellStyle.setDataFormat(format.getFormat("#,##0.00")); // to get decimal format eg : "1234,56" and not "1234,5678" by default
|
||||
|
||||
String cellLocation = currency.equals("USD") ? BALANCE_LOCATION_USD : BALANCE_LOCATION_EUR;
|
||||
configCell(cellLocation, balance, cellStyle);
|
||||
if(credit.getShowBalance() == 1) {
|
||||
String cellLocation = currency.equals("USD") ? BALANCE_LOCATION_USD : BALANCE_LOCATION_EUR;
|
||||
configCell(cellLocation, balance, cellStyle);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected List<Row<String, Object, Integer, Object, BigDecimal>> tableData() {
|
||||
List<Row<String, Object, Integer, Object, BigDecimal>> rows = new ArrayList<>();
|
||||
Row<String, Object, Integer, Object, BigDecimal> row = new Row<>(
|
||||
credit.getDescription().isEmpty() ? "Credit" : credit.getDescription(),
|
||||
credit.getDescription() == null || credit.getDescription().isEmpty() ? "Credit" : credit.getDescription(),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -77,7 +77,10 @@ public class Credit implements Serializable {
|
|||
@Excel(name = "status", width = 15)
|
||||
@ApiModelProperty(value = "status")
|
||||
private java.lang.Integer status;
|
||||
|
||||
/**show balance 0: false, 1 : true*/
|
||||
@Excel(name= "show_balance", width = 15)
|
||||
@ApiModelProperty(value = "show balance")
|
||||
private java.lang.Integer showBalance;
|
||||
/**proof*/
|
||||
@Excel(name = "proof", width = 15)
|
||||
private transient java.lang.String paymentProofString;
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
SET c.update_time = NOW(),
|
||||
c.update_by = #{username},
|
||||
c.description =#{credit.description},
|
||||
c.payment_proof = #{credit.paymentProofString}
|
||||
c.payment_proof = #{credit.paymentProofString},
|
||||
c.show_balance = #{credit.showBalance}
|
||||
WHERE c.id = #{id};
|
||||
</update>
|
||||
<select id="countAllWithFilters" resultType="java.lang.Integer">
|
||||
|
|
|
@ -75,6 +75,10 @@ public class CreditServiceImpl extends ServiceImpl<CreditMapper, Credit> impleme
|
|||
private String INVOICE_TEMPLATE_EU;
|
||||
@Value("${jeecg.path.creditTemplatePath_US}")
|
||||
private String INVOICE_TEMPLATE_US;
|
||||
@Value("${jeecg.path.creditTemplatePath_balance_EU}")
|
||||
private String INVOICE_TEMPLATE_BALANCE_EU;
|
||||
@Value("${jeecg.path.creditTemplatePath_balance_US}")
|
||||
private String INVOICE_TEMPLATE_BALANCE_US;
|
||||
|
||||
@Value("${jeecg.path.creditInvoiceDir}")
|
||||
private String INVOICE_DIR;
|
||||
|
@ -125,9 +129,14 @@ public class CreditServiceImpl extends ServiceImpl<CreditMapper, Credit> impleme
|
|||
public InvoiceMetaData getInvoiceMetaData(CreditInvoice invoice) throws IOException {
|
||||
Path template;
|
||||
if(invoice.getCurrency().equals("USD")) {
|
||||
template = Paths.get(INVOICE_TEMPLATE_US);
|
||||
if(invoice.getCredit().getShowBalance() == 0)
|
||||
template = Paths.get(INVOICE_TEMPLATE_US);
|
||||
else template = Paths.get(INVOICE_TEMPLATE_BALANCE_US);
|
||||
} else {
|
||||
template = Paths.get(INVOICE_TEMPLATE_EU);
|
||||
if(invoice.getCredit().getShowBalance() == 0)
|
||||
template = Paths.get(INVOICE_TEMPLATE_EU);
|
||||
else
|
||||
template = Paths.get(INVOICE_TEMPLATE_BALANCE_EU);
|
||||
}
|
||||
String filename = "Invoice N°" + invoice.getCode() + "(" + invoice.getTargetClient().getInvoiceEntity() + ").xlsx";
|
||||
Path out = Paths.get(INVOICE_DIR, filename);
|
||||
|
|
|
@ -76,6 +76,10 @@ public class CreditPage implements Serializable {
|
|||
@Excel(name = "status", width = 15)
|
||||
@ApiModelProperty(value = "status")
|
||||
private Integer status;
|
||||
/**show balance 0: false, 1: true*/
|
||||
@Excel(name="show_balance", width=15)
|
||||
@ApiModelProperty(value="show_balance")
|
||||
private Integer showBalance;
|
||||
|
||||
/**
|
||||
* rowNum
|
||||
|
|
Loading…
Reference in New Issue