package foundation.icall.callout.ai;
|
|
import foundation.data.entity.Entity;
|
import foundation.data.object.DataObject;
|
import foundation.json.IJSONProvider;
|
import foundation.json.IJSONWriter;
|
import foundation.json.JSONReader;
|
|
public class InvoiceVerificationDetailDao implements IJSONProvider {
|
private DataObject dataObject = DataObject.getInstance("temp_so_implant_invoice_detail");
|
private Entity entity;
|
private String batchId;
|
private String parentId;
|
private boolean isBelong;
|
|
public InvoiceVerificationDetailDao(String batchId, String parentId) {
|
this.batchId = batchId;
|
this.parentId = parentId;
|
}
|
|
public void parse(JSONReader jsonObject) throws Exception {
|
Entity entity = new Entity(dataObject.getTableFieldMetas());
|
entity.set("batch_id", batchId);
|
entity.set("parent_id", parentId);
|
entity.set("line_no", jsonObject.getString("lineNo"));
|
entity.set("name", jsonObject.getString("goodsName"));
|
entity.set("code", jsonObject.getString("goodsCode"));
|
entity.set("spec", jsonObject.getString("specModel"));
|
entity.set("unit", jsonObject.getString("unit"));
|
entity.set("qty", jsonObject.getString("num"));
|
entity.set("price", jsonObject.getString("unitPrice"));
|
entity.set("tax_rate", jsonObject.getString("taxRate"));
|
entity.set("amt_tax", jsonObject.getString("taxAmount"));
|
entity.set("classify_code_tax", jsonObject.getString("classifyCodeTax"));
|
|
String amtBeforeTax = jsonObject.getString("detailAmount");
|
entity.set("amt_before_tax", amtBeforeTax);
|
double amtTax = Double.valueOf(jsonObject.getString("amtTax"));
|
|
double detailAmount = Double.valueOf(amtBeforeTax);
|
double amtAfterTaxValue = amtTax + detailAmount;
|
entity.set("amt_after_tax", Double.toString(amtAfterTaxValue));
|
this.entity = entity;
|
|
isBelong = jsonObject.getBoolean("isBelong", true);
|
}
|
|
public Entity getEntity() {
|
return entity;
|
}
|
|
public String getName() {
|
return entity.getString("name");
|
}
|
|
public boolean isBelong() {
|
return isBelong;
|
}
|
|
public void setBelong(boolean isBelong) {
|
this.isBelong = isBelong;
|
}
|
|
public void writeJSON(IJSONWriter writer) {
|
entity.writeJSON(writer);
|
}
|
}
|