Fixed rounding bug on invoice total calculation BOD-120. Added documents viewing to edit invoice BOD-75 BOD-63.
This commit is contained in:
@@ -23,7 +23,7 @@ export default function InvoiceFormComponent({
|
||||
lineData,
|
||||
responsibilityCenters,
|
||||
loadLines,
|
||||
hideVendor,
|
||||
invoiceEdit,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -61,6 +61,7 @@ export default function InvoiceFormComponent({
|
||||
>
|
||||
<JobSearchSelect
|
||||
options={roAutoCompleteOptions}
|
||||
disabled={invoiceEdit}
|
||||
onBlur={() => {
|
||||
if (form.getFieldValue("jobid") !== null) {
|
||||
loadLines({ variables: { id: form.getFieldValue("jobid") } });
|
||||
@@ -71,7 +72,7 @@ export default function InvoiceFormComponent({
|
||||
<Form.Item
|
||||
label={t("invoices.fields.vendor")}
|
||||
name="vendorid"
|
||||
style={{ display: hideVendor ? "none" : null }}
|
||||
style={{ display: invoiceEdit ? "none" : null }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@@ -162,6 +163,7 @@ export default function InvoiceFormComponent({
|
||||
<Form.Item
|
||||
name="upload"
|
||||
label="Upload"
|
||||
style={{ display: invoiceEdit ? "none" : null }}
|
||||
valuePropName="fileList"
|
||||
getValueFromEvent={(e) => {
|
||||
console.log("Upload event:", e);
|
||||
@@ -239,10 +241,6 @@ export default function InvoiceFormComponent({
|
||||
return null;
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<Button onClick={() => console.log(form.getFieldsValue())}>
|
||||
Get Values
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export function InvoiceFormContainer({ bodyshop, form, hideVendor }) {
|
||||
export function InvoiceFormContainer({ bodyshop, form, invoiceEdit }) {
|
||||
const { data: RoAutoCompleteData } = useQuery(ACTIVE_JOBS_FOR_AUTOCOMPLETE, {
|
||||
variables: { statuses: bodyshop.md_ro_statuses.open_statuses || ["Open"] },
|
||||
});
|
||||
@@ -27,7 +27,7 @@ export function InvoiceFormContainer({ bodyshop, form, hideVendor }) {
|
||||
<div>
|
||||
<InvoiceFormComponent
|
||||
form={form}
|
||||
hideVendor={hideVendor}
|
||||
invoiceEdit={invoiceEdit}
|
||||
roAutoCompleteOptions={RoAutoCompleteData && RoAutoCompleteData.jobs}
|
||||
vendorAutoCompleteOptions={
|
||||
VendorAutoCompleteData && VendorAutoCompleteData.vendors
|
||||
|
||||
@@ -33,7 +33,7 @@ export const CalculateInvoiceTotal = (invoice) => {
|
||||
}
|
||||
});
|
||||
|
||||
const invoiceTotal = Dinero({ amount: (parseFloat(total) || 0) * 100 });
|
||||
const invoiceTotal = Dinero({ amount: Math.round((total || 0) * 100) });
|
||||
const enteredTotal = subtotal.add(federalTax).add(stateTax).add(localTax);
|
||||
const discrepancy = enteredTotal.subtract(invoiceTotal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user