Merge pull request #153 from LQYBill/feat/creditShowBalance

feat: show/hide balance in credit invoice + fix
pull/8523/head
Qiuyi LI 2025-04-18 12:13:27 +02:00 committed by GitHub
commit 102e2fb8a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 7 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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">

View File

@ -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);

View File

@ -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