Added invoice totals + high level reconciliation on PLI jobs tab. BOD-26

This commit is contained in:
Patrick Fic
2020-05-13 16:34:03 -07:00
parent 23a6900906
commit 0473421c6c
15 changed files with 253 additions and 124 deletions

View File

@@ -44,21 +44,23 @@ export default function InvoiceFormComponent({
setDiscount(matchingVendors[0].discount);
}
}
}, [form, setDiscount, vendorAutoCompleteOptions]);
if (form.getFieldValue("jobid")) {
loadLines({ variables: { id: form.getFieldValue("jobid") } });
}
}, [form, setDiscount, vendorAutoCompleteOptions, loadLines]);
return (
<div className="invoice-form-wrapper">
<div className="invoice-form-invoice-details">
<div className='invoice-form-wrapper'>
<div className='invoice-form-invoice-details'>
<Form.Item
name="jobid"
name='jobid'
label={t("invoices.fields.ro_number")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<JobSearchSelect
options={roAutoCompleteOptions}
disabled={invoiceEdit}
@@ -71,81 +73,73 @@ export default function InvoiceFormComponent({
</Form.Item>
<Form.Item
label={t("invoices.fields.vendor")}
name="vendorid"
name='vendorid'
style={{ display: invoiceEdit ? "none" : null }}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<VendorSearchSelect
options={vendorAutoCompleteOptions}
onSelect={handleVendorSelect}
/>
</Form.Item>
</div>
<div className="invoice-form-invoice-details">
<div className='invoice-form-invoice-details'>
<Form.Item
label={t("invoices.fields.invoice_number")}
name="invoice_number"
name='invoice_number'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<Input />
</Form.Item>
<Form.Item
label={t("invoices.fields.date")}
name="date"
name='date'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<DatePicker />
</Form.Item>
<Form.Item
label={t("invoices.fields.is_credit_memo")}
name="is_credit_memo"
valuePropName="checked"
>
name='is_credit_memo'
valuePropName='checked'>
<Switch />
</Form.Item>
<Form.Item
label={t("invoices.fields.total")}
name="total"
name='total'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<CurrencyInput />
</Form.Item>
<Form.Item
label={t("invoices.fields.federal_tax_rate")}
name="federal_tax_rate"
>
name='federal_tax_rate'>
<CurrencyInput />
</Form.Item>
<Form.Item
label={t("invoices.fields.state_tax_rate")}
name="state_tax_rate"
>
name='state_tax_rate'>
<CurrencyInput />
</Form.Item>
<Form.Item
label={t("invoices.fields.local_tax_rate")}
name="local_tax_rate"
>
name='local_tax_rate'>
<CurrencyInput />
</Form.Item>
</div>
@@ -161,19 +155,18 @@ export default function InvoiceFormComponent({
// </Form.Item>
}
<Form.Item
name="upload"
label="Upload"
name='upload'
label='Upload'
style={{ display: invoiceEdit ? "none" : null }}
valuePropName="fileList"
valuePropName='fileList'
getValueFromEvent={(e) => {
console.log("Upload event:", e);
if (Array.isArray(e)) {
return e;
}
return e && e.fileList;
}}
>
<Upload name="logo" beforeUpload={() => false} listType="picture">
}}>
<Upload name='logo' beforeUpload={() => false} listType='picture'>
<Button>Click to upload</Button>
</Upload>
</Form.Item>
@@ -196,7 +189,7 @@ export default function InvoiceFormComponent({
totals = CalculateInvoiceTotal(values);
if (!!totals)
return (
<div className="invoice-form-totals">
<div className='invoice-form-totals'>
<Statistic
title={t("invoices.labels.subtotal")}
value={totals.subtotal.toFormat()}