Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Purchase order PDF improvements (#558)

Brad Barbin7f9ef9ada1c3
diff --git a/apps/erp/app/components/Location.tsx b/apps/erp/app/components/Location.tsx
index d2eaff707a..8183a83055 100644
--- a/apps/erp/app/components/Location.tsx
+++ b/apps/erp/app/components/Location.tsx
@@ -43,7 +43,7 @@ const Location = ({ location, actions }: LocationProps) => {
);
return (
<div className="grid w-full gap-4 grid-cols-[auto_1fr_auto]">
- <LuMapPin className="w-8 h-8" />
+ <LuMapPin className="size-5 mt-2" />
<VStack spacing={0}>
<p className="font-bold line-clamp-1">{locationName}</p>
<p className="text-sm text-muted-foreground line-clamp-1">
diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.ts
index 48fc89cd09..c81b5d6ae3 100644
--- a/apps/erp/app/modules/purchasing/purchasing.models.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts
@@ -184,6 +184,7 @@ export const purchaseOrderLineValidator = z
promisedDate: zfd.text(z.string().optional()),
purchaseQuantity: zfd.numeric(z.number().optional()),
purchaseUnitOfMeasureCode: zfd.text(z.string().optional()),
+ requestedDate: zfd.text(z.string().optional()),
shelfId: zfd.text(z.string().optional()),
supplierShippingCost: zfd.numeric(z.number().optional()),
supplierTaxAmount: zfd.numeric(z.number().optional()),
@@ -287,7 +288,8 @@ export const supplierValidator = z.object({
accountManagerId: zfd.text(z.string().optional()),
currencyCode: zfd.text(z.string().optional()),
purchasingContactId: zfd.text(z.string().optional()),
- invoicingContactId: zfd.text(z.string().optional()),
+ taxId: zfd.text(z.string().optional()),
+ vatNumber: zfd.text(z.string().optional()),
website: zfd.text(z.string().optional())
// defaultCc: z.array(z.string().email()).default([])
});
@@ -332,7 +334,8 @@ export const supplierShippingValidator = z.object({
export const supplierAccountingValidator = z.object({
id: zfd.text(z.string()),
supplierTypeId: zfd.text(z.string().optional()),
- taxId: zfd.text(z.string().optional())
+ taxId: zfd.text(z.string().optional()),
+ vatNumber: zfd.text(z.string().optional())
});
export const supplierTypeValidator = z.object({
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
index 8146bbb350..a5d49f482d 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx
@@ -1,5 +1,5 @@
import { useCarbon } from "@carbon/auth";
-import { Combobox, ValidatedForm } from "@carbon/form";
+import { Combobox, DatePicker, ValidatedForm } from "@carbon/form";
import {
Badge,
cn,
@@ -19,6 +19,7 @@ import {
VStack
} from "@carbon/react";
import { getItemReadableId } from "@carbon/utils";
+import { getLocalTimeZone, today } from "@internationalized/date";
import type { PostgrestResponse } from "@supabase/supabase-js";
import { useEffect, useMemo, useState } from "react";
import { useFetcher, useParams } from "react-router";
@@ -88,31 +89,35 @@ const PurchaseOrderLineForm = ({
const [locationId, setLocationId] = useState(initialValues.locationId);
const [itemData, setItemData] = useState<{
itemId: string;
+ conversionFactor: number;
description: string;
+ fallbackUnitPrice: number;
+ inventoryUom: string;
+ minimumOrderQuantity?: number;
+ priceBreaks: Array<{ quantity: number; unitPrice: number }>;
purchaseQuantity: number;
- supplierUnitPrice: number;
- supplierShippingCost: number;
purchaseUom: string;
- inventoryUom: string;
- conversionFactor: number;
+ requestedDate: string | null;
shelfId: string | null;
- minimumOrderQuantity?: number;
+ supplierShippingCost: number;
supplierTaxAmount: number;
+ supplierUnitPrice: number;
taxPercent: number;
- priceBreaks: Array<{ quantity: number; unitPrice: number }>;
- fallbackUnitPrice: number;
}>({
itemId: initialValues.itemId ?? "",
+ conversionFactor: initialValues.conversionFactor ?? 1,
description: initialValues.description ?? "",
+ fallbackUnitPrice: initialValues.supplierUnitPrice ?? 0,
+ inventoryUom: initialValues.inventoryUnitOfMeasureCode ?? "",
+ minimumOrderQuantity: undefined,
purchaseQuantity: initialValues.purchaseQuantity ?? 1,
- supplierUnitPrice: initialValues.supplierUnitPrice ?? 0,
- supplierShippingCost: initialValues.supplierShippingCost ?? 0,
purchaseUom: initialValues.purchaseUnitOfMeasureCode ?? "",
- inventoryUom: initialValues.inventoryUnitOfMeasureCode ?? "",
- conversionFactor: initialValues.conversionFactor ?? 1,
+ priceBreaks: [],
+ requestedDate: initialValues?.requestedDate ?? null,
shelfId: initialValues.shelfId ?? "",
- minimumOrderQuantity: undefined,
+ supplierShippingCost: initialValues.supplierShippingCost ?? 0,
supplierTaxAmount: initialValues.supplierTaxAmount ?? 0,
+ supplierUnitPrice: initialValues.supplierUnitPrice ?? 0,
taxPercent:
(initialValues.supplierUnitPrice ?? 0) *
(initialValues.purchaseQuantity ?? 1) +
@@ -122,9 +127,7 @@ const PurchaseOrderLineForm = ({
((initialValues.supplierUnitPrice ?? 0) *
(initialValues.purchaseQuantity ?? 1) +
(initialValues.supplierShippingCost ?? 0))
- : 0,
- priceBreaks: [],
- fallbackUnitPrice: initialValues.supplierUnitPrice ?? 0
+ : 0
});
// update tax amount when quantity or unit price changes
@@ -189,19 +192,20 @@ const PurchaseOrderLineForm = ({
setItemType(t as MethodItemType);
setItemData({
itemId: "",
+ conversionFactor: 1,
description: "",
- purchaseQuantity: 1,
- supplierUnitPrice: 0,
- supplierShippingCost: 0,
+ fallbackUnitPrice: 0,
inventoryUom: "",
+ minimumOrderQuantity: undefined,
+ priceBreaks: [],
+ purchaseQuantity: 1,
purchaseUom: "",
- conversionFactor: 1,
+ requestedDate: null,
shelfId: "",
- minimumOrderQuantity: undefined,
+ supplierShippingCost: 0,
supplierTaxAmount: 0,
- taxPercent: 0,
- priceBreaks: [],
- fallbackUnitPrice: 0
+ supplierUnitPrice: 0,
+ taxPercent: 0
});
};
@@ -243,6 +247,7 @@ const PurchaseOrderLineForm = ({
const itemReplenishment = item?.data?.itemReplenishment;
const exchangeRate = routeData?.purchaseOrder?.exchangeRate ?? 1;
const initialQty = supplierPart?.data?.minimumOrderQuantity ?? 1;
+ const leadTime = item?.data?.itemReplenishment?.leadTime ?? 0;
const baseFallback =
(supplierPart?.data?.unitPrice ?? itemCost?.unitCost ?? 0) /
exchangeRate;
@@ -273,6 +278,10 @@ const PurchaseOrderLineForm = ({
supplierPart?.data?.conversionFactor ??
itemReplenishment?.conversionFactor ??
1,
+ requestedDate:
+ leadTime === 0
+ ? null
+ : today(getLocalTimeZone()).add({ days: leadTime }).toString(),
shelfId: inventory.data?.defaultShelfId ?? null,
supplierTaxAmount: 0,
taxPercent: 0,
@@ -407,7 +416,7 @@ const PurchaseOrderLineForm = ({
onTypeChange={onTypeChange}
/>
- <FormControl className="col-span-2">
+ <FormControl>
<FormLabel>Description</FormLabel>
<Input
value={itemData.description}
@@ -424,6 +433,18 @@ const PurchaseOrderLineForm = ({
<JobOperationSelect jobId={initialValues.jobId} />
)}
+ <DatePicker
+ name="requestedDate"
+ label="Required Date"
+ value={itemData?.requestedDate ?? undefined}
+ onChange={(date) => {
+ setItemData((d) => ({
+ ...d,
+ requestedDate: date
+ }));
+ }}
+ />
+
<NumberControlled
minValue={itemData.minimumOrderQuantity}
name="purchaseQuantity"
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierAccountingForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierAccountingForm.tsx
deleted file mode 100644
index 42d0dd6932..0000000000
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierAccountingForm.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { ValidatedForm } from "@carbon/form";
-import {
- Card,
- CardContent,
- CardFooter,
- CardHeader,
- CardTitle,
- HStack
-} from "@carbon/react";
-import type { z } from "zod";
-import { Hidden, Input, Submit, SupplierType } from "~/components/Form";
-import { usePermissions } from "~/hooks";
-import { supplierAccountingValidator } from "~/modules/purchasing";
-
-type SupplierPaymentFormProps = {
- initialValues: z.infer<typeof supplierAccountingValidator>;
-};
-
-const SupplierAccountingForm = ({
- initialValues
-}: SupplierPaymentFormProps) => {
- const permissions = usePermissions();
-
- const isDisabled = !permissions.can("update", "purchasing");
-
- return (
- <ValidatedForm
- method="post"
- validator={supplierAccountingValidator}
- defaultValues={initialValues}
- >
- <Card>
- <CardHeader>
- <CardTitle>Supplier Accounting</CardTitle>
- </CardHeader>
- <CardContent>
- <Hidden name="id" />
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-x-8 gap-y-4 w-full">
- <Input name="taxId" label="Tax ID" />
- <SupplierType
- name="supplierTypeId"
- label="Posting Group"
- placeholder="Select Posting Group"
- />
- </div>
- </CardContent>
- <CardFooter>
- <HStack>
- <Submit isDisabled={isDisabled}>Save</Submit>
- </HStack>
- </CardFooter>
- </Card>
- </ValidatedForm>
- );
-};
-
-export default SupplierAccountingForm;
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierForm.tsx
index 546e8edbf4..28e76084d7 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierForm.tsx
@@ -112,6 +112,8 @@ const SupplierForm = ({
/>
<Employee name="accountManagerId" label="Account Manager" />
<Currency name="currencyCode" label="Currency" />
+ <Input name="taxId" label="Tax ID" />
+ <Input name="vatNumber" label="VAT Number" />
<Input name="website" label="Website" />
{isEditing && (
<>
@@ -120,11 +122,6 @@ const SupplierForm = ({
name="purchasingContactId"
label="Purchasing Contact"
/>
- <SupplierContact
- supplier={initialValues.id}
- name="invoicingContactId"
- label="Invoicing Contact"
- />
</>
)}
{/* <EmailRecipients name="defaultCc" label="Default CC" /> */}
diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
index 6a3d081b3a..3c55cef594 100644
--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierSidebar/useSupplierSidebar.tsx
@@ -47,7 +47,7 @@ export function useSupplierSidebar({ contacts, locations }: Props) {
shortcut: "Command+Shift+l"
},
{
- name: "Payment Terms",
+ name: "Payment",
to: path.to.supplierPayment(supplierId),
role: ["employee"],
icon: <LuCreditCard />,
diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.ts
index 5b70ea9d47..b49054234b 100644
--- a/apps/erp/app/modules/sales/sales.models.ts
+++ b/apps/erp/app/modules/sales/sales.models.ts
@@ -47,7 +47,8 @@ export const salesRFQStatusType = [
export const customerAccountingValidator = z.object({
id: zfd.text(z.string()),
customerTypeId: zfd.text(z.string().optional()),
- taxId: zfd.text(z.string().optional())
+ taxId: zfd.text(z.string().optional()),
+ vatNumber: zfd.text(z.string().optional())
});
export const customerContactValidator = z.object({
@@ -69,11 +70,12 @@ export const customerValidator = z.object({
customerTypeId: zfd.text(z.string().optional()),
accountManagerId: zfd.text(z.string().optional()),
currencyCode: zfd.text(z.string().optional()),
+ taxId: zfd.text(z.string().optional()),
taxPercent: zfd.numeric(
z.number().min(0).max(1, { message: "Tax percent must be between 0 and 1" })
),
+ vatNumber: zfd.text(z.string().optional()),
salesContactId: zfd.text(z.string().optional()),
- invoicingContactId: zfd.text(z.string().optional()),
website: zfd.text(z.string().optional())
// defaultCc: z.array(z.string().email()).default([])
});
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerAccountingForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerAccountingForm.tsx
deleted file mode 100644
index a4bbc69021..0000000000
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerAccountingForm.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { ValidatedForm } from "@carbon/form";
-import {
- Card,
- CardContent,
- CardFooter,
- CardHeader,
- CardTitle,
- HStack
-} from "@carbon/react";
-import type { z } from "zod";
-import { CustomerType, Hidden, Input, Submit } from "~/components/Form";
-import { usePermissions } from "~/hooks";
-import { customerAccountingValidator } from "../../sales.models";
-
-type CustomerPaymentFormProps = {
- initialValues: z.infer<typeof customerAccountingValidator>;
-};
-
-const CustomerAccountingForm = ({
- initialValues
-}: CustomerPaymentFormProps) => {
- const permissions = usePermissions();
-
- const isDisabled = !permissions.can("update", "sales");
-
- return (
- <ValidatedForm
- method="post"
- validator={customerAccountingValidator}
- defaultValues={initialValues}
- >
- <Card>
- <CardHeader>
- <CardTitle>Customer Accounting</CardTitle>
- </CardHeader>
- <CardContent>
- <Hidden name="id" />
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-x-8 gap-y-4 w-full">
- <Input name="taxId" label="Tax ID" />
- <CustomerType
- name="customerTypeId"
- label="Posting Group"
- placeholder="Select Posting Group"
- />
- </div>
- </CardContent>
- <CardFooter>
- <HStack>
- <Submit isDisabled={isDisabled}>Save</Submit>
- </HStack>
- </CardFooter>
- </Card>
- </ValidatedForm>
- );
-};
-
-export default CustomerAccountingForm;
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx
index 489bf8b02c..8d3cf4eccf 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx
@@ -130,6 +130,8 @@ const CustomerForm = ({
}}
/>
+ <Input name="taxId" label="Tax ID" />
+ <Input name="vatNumber" label="VAT Number" />
<Input name="website" label="Website" />
{isEditing && (
@@ -139,11 +141,6 @@ const CustomerForm = ({
name="salesContactId"
label="Sales Contact"
/>
- <CustomerContact
- customer={initialValues.id}
- name="invoicingContactId"
- label="Invoicing Contact"
- />
</>
)}
{/* <EmailRecipients name="defaultCc" label="Default CC" /> */}
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
index c8a4b57799..22a6816e5e 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -66,7 +66,6 @@ const CustomerHeader = () => {
(status) => status.id === routeData?.customer?.customerStatusId
)?.name;
- // biome-ignore lint/correctness/useExhaustiveDependencies: suppressed due to migration
const onUpdateTags = useCallback(
(value: string[]) => {
const formData = new FormData();
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
index 7cd6ecd959..851cd8c84c 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerSidebar/useCustomerSidebar.tsx
@@ -49,7 +49,7 @@ export function useCustomerSidebar({ contacts, locations }: Props) {
shortcut: "Command+Shift+l"
},
{
- name: "Payment Terms",
+ name: "Payment",
to: path.to.customerPayment(customerId),
role: ["employee"],
icon: <LuCreditCard />,
diff --git a/apps/erp/app/modules/settings/settings.models.ts b/apps/erp/app/modules/settings/settings.models.ts
index 36d56f09a3..fd956a0150 100644
--- a/apps/erp/app/modules/settings/settings.models.ts
+++ b/apps/erp/app/modules/settings/settings.models.ts
@@ -64,7 +64,8 @@ const company = {
phone: zfd.text(z.string().optional()),
fax: zfd.text(z.string().optional()),
email: zfd.text(z.string().optional()),
- website: zfd.text(z.string().optional())
+ website: zfd.text(z.string().optional()),
+ vatNumber: zfd.text(z.string().optional())
};
export const companyValidator = z.object(company);
@@ -181,10 +182,18 @@ export const supplierQuoteNotificationValidator = z.object({
.optional()
});
+export const accountsPayableEmailValidator = z.object({
+ accountsPayableEmail: zfd.text(z.string().email().optional())
+});
+
export const defaultSupplierCcValidator = z.object({
defaultSupplierCc: z.array(z.string().email()).optional()
});
+export const accountsReceivableEmailValidator = z.object({
+ accountsReceivableEmail: zfd.text(z.string().email().optional())
+});
+
export const defaultCustomerCcValidator = z.object({
defaultCustomerCc: z.array(z.string().email()).optional()
});
@@ -253,3 +262,20 @@ export const quoteLineCategoryMarkupsSettingsValidator = z.object({
overheadCost: zfd.numeric(z.number().min(0).default(0)),
outsideCost: zfd.numeric(z.number().min(0).default(0))
});
+
+const billingAddress = {
+ name: zfd.text(z.string().optional()),
+ addressLine1: zfd.text(z.string().optional()),
+ addressLine2: zfd.text(z.string().optional()),
+ city: zfd.text(z.string().optional()),
+ state: zfd.text(z.string().optional()),
+ postalCode: zfd.text(z.string().optional()),
+ countryCode: zfd.text(z.string().optional()),
+ phone: zfd.text(z.string().optional()),
+ fax: zfd.text(z.string().optional()),
+ email: zfd.text(z.string().email().optional())
+};
+
+export const accountsPayableBillingAddressValidator = z.object(billingAddress);
+export const accountsReceivableBillingAddressValidator =
+ z.object(billingAddress);
diff --git a/apps/erp/app/modules/settings/settings.service.ts b/apps/erp/app/modules/settings/settings.service.ts
index 7f83a278d9..a16779018f 100644
--- a/apps/erp/app/modules/settings/settings.service.ts
+++ b/apps/erp/app/modules/settings/settings.service.ts
@@ -8,6 +8,8 @@ import { setGenericQueryFilters } from "~/utils/query";
import { interpolateSequenceDate } from "~/utils/string";
import { sanitize } from "~/utils/supabase";
import type {
+ accountsPayableBillingAddressValidator,
+ accountsReceivableBillingAddressValidator,
apiKeyValidator,
companyValidator,
kanbanOutputTypes,
@@ -16,6 +18,52 @@ import type {
webhookValidator
} from "./settings.models";
+export async function getAccountsPayableBillingAddress(
+ client: SupabaseClient<Database>,
+ companyId: string
+) {
+ return client
+ .from("companyAccountsPayableBillingAddress")
+ .select("*")
+ .eq("id", companyId)
+ .single();
+}
+
+export async function getAccountsReceivableBillingAddress(
+ client: SupabaseClient<Database>,
+ companyId: string
+) {
+ return client
+ .from("companyAccountsReceivableBillingAddress")
+ .select("*")
+ .eq("id", companyId)
+ .single();
+}
+
+export async function updateAccountsPayableBillingAddress(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ data: z.infer<typeof accountsPayableBillingAddressValidator>,
+ updatedBy: string
+) {
+ return client
+ .from("companyAccountsPayableBillingAddress")
+ .update(sanitize({ ...data, updatedBy }))
+ .eq("id", companyId);
+}
+
+export async function updateAccountsReceivableBillingAddress(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ data: z.infer<typeof accountsReceivableBillingAddressValidator>,
+ updatedBy: string
+) {
+ return client
+ .from("companyAccountsReceivableBillingAddress")
+ .update(sanitize({ ...data, updatedBy }))
+ .eq("id", companyId);
+}
+
export async function deleteApiKey(
client: SupabaseClient<Database>,
id: string
@@ -102,7 +150,7 @@ export async function getCompany(
companyId: string
) {
const company = await client
- .from("company")
+ .from("companies")
.select("*")
.eq("id", companyId)
.single();
@@ -707,6 +755,52 @@ export async function updatePurchasePriceUpdateTimingSetting(
.eq("id", companyId);
}
+export async function updateAccountsPayableAddressSetting(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ accountsPayableAddress: boolean
+) {
+ return client
+ .from("companySettings")
+ .update(sanitize({ accountsPayableAddress }))
+ .eq("id", companyId);
+}
+
+export async function updateAccountsReceivableAddressSetting(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ accountsReceivableAddress: boolean
+) {
+ return client
+ .from("companySettings")
+ .update(sanitize({ accountsReceivableAddress }))
+ .eq("id", companyId);
+}
+
+export async function updateAccountsPayableEmail(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ accountsPayableEmail: string | undefined
+) {
+ return client
+ .from("companySettings")
+ .update(sanitize({ accountsPayableEmail: accountsPayableEmail ?? null }))
+ .eq("id", companyId);
+}
+
+export async function updateAccountsReceivableEmail(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ accountsReceivableEmail: string | undefined
+) {
+ return client
+ .from("companySettings")
+ .update(
+ sanitize({ accountsReceivableEmail: accountsReceivableEmail ?? null })
+ )
+ .eq("id", companyId);
+}
+
export async function updateDefaultSupplierCc(
client: SupabaseClient<Database>,
companyId: string,
diff --git a/apps/erp/app/modules/settings/ui/Company/CompanyForm.tsx b/apps/erp/app/modules/settings/ui/Company/CompanyForm.tsx
index 6dc196351a..f1ebc97bb2 100644
--- a/apps/erp/app/modules/settings/ui/Company/CompanyForm.tsx
+++ b/apps/erp/app/modules/settings/ui/Company/CompanyForm.tsx
@@ -25,6 +25,7 @@ const CompanyForm = ({ company }: CompanyFormProps) => {
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 w-full">
<Input name="name" label="Company Name" />
<Input name="taxId" label="Tax ID" />
+ <Input name="vatNumber" label="VAT Number" />
<AddressAutocomplete variant="grid" />
<Currency
name="baseCurrencyCode"
diff --git a/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx b/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
index 071f056cbc..db60546f93 100644
--- a/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/purchase-order+/$orderId[.]pdf.tsx
@@ -3,13 +3,18 @@ import { PurchaseOrderPDF } from "@carbon/documents/pdf";
import type { JSONContent } from "@carbon/react";
import { renderToStream } from "@react-pdf/renderer";
import type { LoaderFunctionArgs } from "react-router";
+import { getPaymentTermsList } from "~/modules/accounting";
import {
getPurchaseOrder,
getPurchaseOrderLines,
getPurchaseOrderLocations,
getPurchasingTerms
} from "~/modules/purchasing";
-import { getCompany, getCompanySettings } from "~/modules/settings";
+import {
+ getAccountsPayableBillingAddress,
+ getCompany,
+ getCompanySettings
+} from "~/modules/settings";
import { getBase64ImageFromSupabase } from "~/modules/shared";
import { getLocale } from "~/utils/request";
@@ -24,17 +29,21 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const [
company,
companySettings,
+ apBillingAddress,
purchaseOrder,
purchaseOrderLines,
purchaseOrderLocations,
- terms
+ terms,
+ paymentTerms
] = await Promise.all([
getCompany(client, companyId),
getCompanySettings(client, companyId),
+ getAccountsPayableBillingAddress(client, companyId),
getPurchaseOrder(client, orderId),
getPurchaseOrderLines(client, orderId),
getPurchaseOrderLocations(client, orderId),
- getPurchasingTerms(client, companyId)
+ getPurchasingTerms(client, companyId),
+ getPaymentTermsList(client, companyId)
]);
if (company.error) {
@@ -109,7 +118,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const stream = await renderToStream(
<PurchaseOrderPDF
company={company.data}
+ companySettings={companySettings.data}
+ accountsPayableBillingAddress={
+ companySettings.data?.accountsPayableAddress
+ ? apBillingAddress.data
+ : null
+ }
locale={locale}
+ paymentTerms={paymentTerms.data ?? []}
purchaseOrder={purchaseOrder.data}
purchaseOrderLines={purchaseOrderLines.data ?? []}
purchaseOrderLocations={purchaseOrderLocations.data}
diff --git a/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx b/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
index e315604c09..c3a58e6611 100644
--- a/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/quote+/$id[.]pdf.tsx
@@ -14,7 +14,11 @@ import {
getQuoteShipment,
getSalesTerms
} from "~/modules/sales";
-import { getCompany, getCompanySettings } from "~/modules/settings";
+import {
+ getAccountsReceivableBillingAddress,
+ getCompany,
+ getCompanySettings
+} from "~/modules/settings";
import { getBase64ImageFromSupabase } from "~/modules/shared";
import { getLocale } from "~/utils/request";
@@ -31,6 +35,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const [
company,
companySettings,
+ arBillingAddress,
quote,
quoteLines,
quoteLinePrices,
@@ -43,6 +48,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
] = await Promise.all([
getCompany(client, companyId),
getCompanySettings(client, companyId),
+ getAccountsReceivableBillingAddress(client, companyId),
getQuote(client, id),
getQuoteLines(client, id),
getQuoteLinePricesByQuoteId(client, id),
@@ -130,6 +136,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const stream = await renderToStream(
<QuotePDF
company={company.data}
+ companySettings={companySettings.data}
locale={locale}
exchangeRate={exchangeRate}
quote={quote.data}
@@ -138,6 +145,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
quoteCustomerDetails={quoteLocations.data}
payment={quotePayment?.data}
shipment={quoteShipment?.data}
+ accountsReceivableBillingAddress={
+ companySettings.data?.accountsReceivableAddress
+ ? arBillingAddress.data
+ : null
+ }
paymentTerms={paymentTerms.data ?? []}
shippingMethods={shippingMethods.data ?? []}
terms={(terms?.data?.salesTerms ?? {}) as JSONContent}
diff --git a/apps/erp/app/routes/file+/sales-invoice+/$id[.]pdf.tsx b/apps/erp/app/routes/file+/sales-invoice+/$id[.]pdf.tsx
index b4113ca150..4b3b0346e0 100644
--- a/apps/erp/app/routes/file+/sales-invoice+/$id[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/sales-invoice+/$id[.]pdf.tsx
@@ -12,7 +12,11 @@ import {
getSalesInvoiceShipment
} from "~/modules/invoicing";
import { getSalesTerms } from "~/modules/sales";
-import { getCompany, getCompanySettings } from "~/modules/settings";
+import {
+ getAccountsReceivableBillingAddress,
+ getCompany,
+ getCompanySettings
+} from "~/modules/settings";
import { getBase64ImageFromSupabase } from "~/modules/shared";
import { getLocale } from "~/utils/request";
@@ -27,6 +31,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const [
company,
companySettings,
+ arBillingAddress,
salesInvoice,
salesInvoiceLines,
salesInvoiceLocations,
@@ -37,6 +42,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
] = await Promise.all([
getCompany(client, companyId),
getCompanySettings(client, companyId),
+ getAccountsReceivableBillingAddress(client, companyId),
getSalesInvoice(client, id),
getSalesInvoiceLines(client, id),
getSalesInvoiceCustomerDetails(client, id),
@@ -123,6 +129,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const stream = await renderToStream(
<SalesInvoicePDF
company={company.data}
+ companySettings={companySettings.data}
locale={locale}
meta={{
author: "Carbon",
@@ -133,6 +140,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
salesInvoiceLines={salesInvoiceLines.data ?? []}
salesInvoiceLocations={salesInvoiceLocations.data}
salesInvoiceShipment={salesInvoiceShipment.data}
+ accountsReceivableBillingAddress={
+ companySettings.data?.accountsReceivableAddress
+ ? arBillingAddress.data
+ : null
+ }
terms={(terms?.data?.salesTerms ?? {}) as JSONContent}
paymentTerms={paymentTerms.data ?? []}
shippingMethods={shippingMethods.data ?? []}
diff --git a/apps/erp/app/routes/file+/sales-order+/$id[.]pdf.tsx b/apps/erp/app/routes/file+/sales-order+/$id[.]pdf.tsx
index 90cfa065c4..a0d6403933 100644
--- a/apps/erp/app/routes/file+/sales-order+/$id[.]pdf.tsx
+++ b/apps/erp/app/routes/file+/sales-order+/$id[.]pdf.tsx
@@ -11,7 +11,11 @@ import {
getSalesOrderLines,
getSalesTerms
} from "~/modules/sales";
-import { getCompany, getCompanySettings } from "~/modules/settings";
+import {
+ getAccountsReceivableBillingAddress,
+ getCompany,
+ getCompanySettings
+} from "~/modules/settings";
import { getBase64ImageFromSupabase } from "~/modules/shared";
import { getLocale } from "~/utils/request";
@@ -26,6 +30,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const [
company,
companySettings,
+ arBillingAddress,
salesOrder,
salesOrderLines,
salesOrderLocations,
@@ -35,6 +40,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
] = await Promise.all([
getCompany(client, companyId),
getCompanySettings(client, companyId),
+ getAccountsReceivableBillingAddress(client, companyId),
getSalesOrder(client, id),
getSalesOrderLines(client, id),
getSalesOrderCustomerDetails(client, id),
@@ -115,6 +121,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const stream = await renderToStream(
<SalesOrderPDF
company={company.data}
+ companySettings={companySettings.data}
locale={locale}
meta={{
author: "Carbon",
@@ -124,6 +131,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
salesOrder={salesOrder.data}
salesOrderLines={salesOrderLines.data ?? []}
salesOrderLocations={salesOrderLocations.data}
+ accountsReceivableBillingAddress={
+ companySettings.data?.accountsReceivableAddress
+ ? arBillingAddress.data
+ : null
+ }
terms={(terms?.data?.salesTerms ?? {}) as JSONContent}
paymentTerms={paymentTerms.data ?? []}
shippingMethods={shippingMethods.data ?? []}
diff --git a/apps/erp/app/routes/x+/customer+/$customerId.accounting.tsx b/apps/erp/app/routes/x+/customer+/$customerId.accounting.tsx
index 710ca1c6b2..ab11072e21 100644
--- a/apps/erp/app/routes/x+/customer+/$customerId.accounting.tsx
+++ b/apps/erp/app/routes/x+/customer+/$customerId.accounting.tsx
@@ -1,82 +1,15 @@
-import { assertIsPost, error, success } from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { flash } from "@carbon/auth/session.server";
-import { validationError, validator } from "@carbon/form";
-import type { ActionFunctionArgs } from "react-router";
-import { data, redirect, useParams } from "react-router";
-import { useRouteData } from "~/hooks";
-import type { CustomerDetail } from "~/modules/sales";
-import {
- customerAccountingValidator,
- updateCustomerAccounting
-} from "~/modules/sales";
-import CustomerAccountingForm from "~/modules/sales/ui/Customer/CustomerAccountingForm";
+import type { LoaderFunctionArgs } from "react-router";
+import { redirect, useParams } from "react-router";
import { path } from "~/utils/path";
-export async function action({ request }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- create: "purchasing"
- });
- const formData = await request.formData();
- const validation = await validator(customerAccountingValidator).validate(
- formData
- );
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const { id, ...d } = validation.data;
-
- if (!id) {
- throw redirect(
- path.to.customerAccounting(id),
- await flash(request, error(null, "Failed to update customer accounting"))
- );
- }
-
- const update = await updateCustomerAccounting(client, {
- id,
- ...d,
- updatedBy: userId
- });
-
- if (update.error) {
- throw redirect(
- path.to.customerAccounting(id),
- await flash(
- request,
- error(update.error, "Failed to update customer accounting")
- )
- );
- }
-
- return data(
- null,
- await flash(request, success("Updated customer accounting"))
- );
+export async function loader({ params }: LoaderFunctionArgs) {
+ const { customerId } = params;
+ if (!customerId) throw new Error("Could not find customerId");
+ return redirect(path.to.customerDetails(customerId));
}
export default function CustomerAccountingRoute() {
const { customerId } = useParams();
if (!customerId) throw new Error("Could not find customerId");
- const routeData = useRouteData<{ customer: CustomerDetail }>(
- path.to.customer(customerId)
- );
-
- if (!routeData?.customer) return null;
-
- const initialValues = {
- id: routeData?.customer?.id ?? "",
- customerTypeId: routeData?.customer?.customerTypeId ?? undefined,
- taxId: routeData?.customer?.taxId ?? ""
- };
-
- return (
- <CustomerAccountingForm
- key={initialValues.id}
- initialValues={initialValues}
- />
- );
+ return null;
}
diff --git a/apps/erp/app/routes/x+/customer+/$customerId.details.tsx b/apps/erp/app/routes/x+/customer+/$customerId.details.tsx
index 34f630b72f..a2f25f3455 100644
--- a/apps/erp/app/routes/x+/customer+/$customerId.details.tsx
+++ b/apps/erp/app/routes/x+/customer+/$customerId.details.tsx
@@ -66,11 +66,11 @@ export default function CustomerEditRoute() {
customerStatusId: routeData?.customer?.customerStatusId ?? undefined,
accountManagerId: routeData?.customer?.accountManagerId ?? undefined,
taxId: routeData?.customer?.taxId ?? "",
+ vatNumber: routeData?.customer?.vatNumber ?? "",
currencyCode: routeData?.customer?.currencyCode ?? undefined,
taxPercent: routeData?.customer?.taxPercent ?? 0,
website: routeData?.customer?.website ?? "",
salesContactId: routeData?.customer?.salesContactId ?? undefined,
- invoicingContactId: routeData?.customer?.invoicingContactId ?? undefined,
defaultCc: routeData?.customer?.defaultCc ?? [],
...getCustomFields(routeData?.customer?.customFields)
};
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.$lineId.details.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.$lineId.details.tsx
index 82e0d1909d..5898bf6a11 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.$lineId.details.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.$lineId.details.tsx
@@ -153,19 +153,20 @@ export default function EditPurchaseOrderLineRoute() {
itemId: line?.itemId ?? "",
accountNumber: line?.accountNumber ?? "",
assetId: line?.assetId ?? "",
+ conversionFactor: line?.conversionFactor ?? 1,
description: line?.description ?? "",
- purchaseQuantity: line?.purchaseQuantity ?? 1,
- supplierUnitPrice: line?.supplierUnitPrice ?? 0,
- supplierShippingCost: line?.supplierShippingCost ?? 0,
- supplierTaxAmount: line?.supplierTaxAmount ?? 0,
exchangeRate: line?.exchangeRate ?? 1,
- locationId: line?.locationId ?? "",
- purchaseUnitOfMeasureCode: line?.purchaseUnitOfMeasureCode ?? "",
inventoryUnitOfMeasureCode: line?.inventoryUnitOfMeasureCode ?? "",
jobId: line?.jobId ?? "",
jobOperationId: line?.jobOperationId ?? "",
- conversionFactor: line?.conversionFactor ?? 1,
+ locationId: line?.locationId ?? "",
+ purchaseQuantity: line?.purchaseQuantity ?? 1,
+ purchaseUnitOfMeasureCode: line?.purchaseUnitOfMeasureCode ?? "",
+ requestedDate: line?.requestedDate ?? undefined,
shelfId: line?.shelfId ?? "",
+ supplierShippingCost: line?.supplierShippingCost ?? 0,
+ supplierTaxAmount: line?.supplierTaxAmount ?? 0,
+ supplierUnitPrice: line?.supplierUnitPrice ?? 0,
taxPercent: line?.taxPercent ?? 0,
...getCustomFields(line?.customFields)
};
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.new.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.new.tsx
index d054c66775..13fca0ff2c 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.new.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.new.tsx
@@ -63,19 +63,20 @@ export default function NewPurchaseOrderLineRoute() {
if (!orderId) throw new Error("Could not find purchase order id");
const initialValues = {
+ conversionFactor: 1,
+ exchangeRate: 1,
+ inventoryUnitOfMeasureCode: "",
+ itemId: "",
purchaseOrderId: orderId,
purchaseOrderLineType: "Item" as MethodItemType,
- itemId: "",
purchaseQuantity: 1,
- supplierUnitPrice: 0,
+ purchaseUnitOfMeasureCode: "",
+ requestedDate: undefined,
+ setupPrice: 0,
+ shelfId: "",
supplierShippingCost: 0,
supplierTaxAmount: 0,
- exchangeRate: 1,
- setupPrice: 0,
- purchaseUnitOfMeasureCode: "",
- inventoryUnitOfMeasureCode: "",
- conversionFactor: 1,
- shelfId: ""
+ supplierUnitPrice: 0
};
return <PurchaseOrderLineForm initialValues={initialValues} />;
diff --git a/apps/erp/app/routes/x+/purchasing+/planning.update.tsx b/apps/erp/app/routes/x+/purchasing+/planning.update.tsx
index 7cf584c969..54fc4d8564 100644
--- a/apps/erp/app/routes/x+/purchasing+/planning.update.tsx
+++ b/apps/erp/app/routes/x+/purchasing+/planning.update.tsx
@@ -412,7 +412,7 @@ export async function action({ request }: ActionFunctionArgs) {
(supplier.taxPercent ?? 0)) /
100,
supplierShippingCost: 0,
- promisedDate: earliestDueDate ?? undefined,
+ requestedDate: earliestDueDate ?? undefined,
locationId,
companyId,
createdBy: userId
diff --git a/apps/erp/app/routes/x+/settings+/company.tsx b/apps/erp/app/routes/x+/settings+/company.tsx
index c9fa29333c..c02d262eb9 100644
--- a/apps/erp/app/routes/x+/settings+/company.tsx
+++ b/apps/erp/app/routes/x+/settings+/company.tsx
@@ -66,6 +66,7 @@ export default function Company() {
const initialValues = {
name: company.name,
taxId: company.taxId ?? undefined,
+ vatNumber: company.vatNumber ?? undefined,
addressLine1: company.addressLine1 ?? "",
addressLine2: company.addressLine2 ?? undefined,
city: company.city ?? "",
diff --git a/apps/erp/app/routes/x+/settings+/purchasing.tsx b/apps/erp/app/routes/x+/settings+/purchasing.tsx
index 176406113c..c4adbfb191 100644
--- a/apps/erp/app/routes/x+/settings+/purchasing.tsx
+++ b/apps/erp/app/routes/x+/settings+/purchasing.tsx
@@ -4,6 +4,7 @@ import { flash } from "@carbon/auth/session.server";
// biome-ignore lint/suspicious/noShadowRestrictedNames: suppressed due to migration
import {
Boolean,
+ Input,
Select,
Submit,
ValidatedForm,
@@ -24,26 +25,32 @@ import {
HStack,
Label,
ScrollArea,
+ Switch,
toast,
useDebounce,
VStack
} from "@carbon/react";
import { Editor } from "@carbon/react/Editor";
import { getLocalTimeZone, today } from "@internationalized/date";
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { LuCircleCheck } from "react-icons/lu";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { redirect, useFetcher, useLoaderData } from "react-router";
import { EmailRecipients, Users } from "~/components/Form";
+import Country from "~/components/Form/Country";
import { usePermissions, useUser } from "~/hooks";
import {
+ accountsPayableBillingAddressValidator,
defaultSupplierCcValidator,
+ getAccountsPayableBillingAddress,
getCompanySettings,
getTerms,
includeThumbnailsOnPurchasingPdfsValidator,
purchasePriceUpdateTimingTypes,
purchasePriceUpdateTimingValidator,
supplierQuoteNotificationValidator,
+ updateAccountsPayableAddressSetting,
+ updateAccountsPayableBillingAddress,
updateDefaultSupplierCc,
updatePurchasePriceUpdateTimingSetting,
updatePurchasingPdfThumbnails,
@@ -62,9 +69,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
view: "settings"
});
- const [companySettings, terms] = await Promise.all([
+ const [companySettings, terms, apBillingAddress] = await Promise.all([
getCompanySettings(client, companyId),
- getTerms(client, companyId)
+ getTerms(client, companyId),
+ getAccountsPayableBillingAddress(client, companyId)
]);
if (companySettings.error) {
@@ -86,12 +94,13 @@ export async function loader({ request }: LoaderFunctionArgs) {
return {
companySettings: companySettings.data,
- terms: terms.data
+ terms: terms.data,
+ apBillingAddress: apBillingAddress.data
};
}
export async function action({ request }: ActionFunctionArgs) {
- const { client, companyId } = await requirePermissions(request, {
+ const { client, companyId, userId } = await requirePermissions(request, {
update: "settings"
});
@@ -99,6 +108,21 @@ export async function action({ request }: ActionFunctionArgs) {
const intent = formData.get("intent");
switch (intent) {
+ case "accountsPayableAddressToggle":
+ const apToggleEnabled = formData.get("enabled") === "true";
+ const apToggleResult = await updateAccountsPayableAddressSetting(
+ client,
+ companyId,
+ apToggleEnabled
+ );
+ if (apToggleResult.error) {
+ return { success: false, message: apToggleResult.error.message };
+ }
+ return {
+ success: true,
+ message: `Accounts payable billing address ${apToggleEnabled ? "enabled" : "disabled"}`
+ };
+
case "purchasePriceUpdateTiming":
const validation = await validator(
purchasePriceUpdateTimingValidator
@@ -167,6 +191,31 @@ export async function action({ request }: ActionFunctionArgs) {
return { success: true, message: "PDF settings updated" };
+ case "accountsPayableBillingAddress":
+ const apBillingValidation = await validator(
+ accountsPayableBillingAddressValidator
+ ).validate(formData);
+
+ if (apBillingValidation.error) {
+ return { success: false, message: "Invalid form data" };
+ }
+
+ const apBillingResult = await updateAccountsPayableBillingAddress(
+ client,
+ companyId,
+ apBillingValidation.data,
+ userId
+ );
+
+ if (apBillingResult.error) {
+ return { success: false, message: apBillingResult.error.message };
+ }
+
+ return {
+ success: true,
+ message: "Accounts payable billing address updated"
+ };
+
case "emails":
const defaultSupplierCcValidation = await validator(
defaultSupplierCcValidator
@@ -199,7 +248,8 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function PurchasingSettingsRoute() {
- const { companySettings, terms } = useLoaderData<typeof loader>();
+ const { companySettings, terms, apBillingAddress } =
+ useLoaderData<typeof loader>();
const fetcher = useFetcher<typeof action>();
const permissions = usePermissions();
const { carbon } = useCarbon();
@@ -218,6 +268,31 @@ export default function PurchasingSettingsRoute() {
}
}, [fetcher.data?.message, fetcher.data?.success]);
+ const toggleFetcher = useFetcher<typeof action>();
+ const [apAddressEnabled, setApAddressEnabled] = useState(
+ companySettings.accountsPayableAddress ?? false
+ );
+
+ const handleApAddressToggle = useCallback(
+ (checked: boolean) => {
+ setApAddressEnabled(checked);
+ toggleFetcher.submit(
+ { intent: "accountsPayableAddressToggle", enabled: checked.toString() },
+ { method: "POST" }
+ );
+ },
+ [toggleFetcher]
+ );
+
+ useEffect(() => {
+ if (toggleFetcher.data?.success === true && toggleFetcher?.data?.message) {
+ toast.success(toggleFetcher.data.message);
+ }
+ if (toggleFetcher.data?.success === false && toggleFetcher?.data?.message) {
+ toast.error(toggleFetcher.data.message);
+ }
+ }, [toggleFetcher.data?.message, toggleFetcher.data?.success]);
+
const [purchasingTermsStatus, setPurchasingTermsStatus] = useState<
"saved" | "draft"
>("saved");
@@ -257,6 +332,114 @@ export default function PurchasingSettingsRoute() {
className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4"
>
<Heading size="h3">Purchasing</Heading>
+ <Card>
+ <HStack className="justify-between items-start">
+ <CardHeader>
+ <CardTitle>Purchasing Terms &amp; Conditions</CardTitle>
+ <CardDescription>
+ Define the terms and conditions for purchase orders
+ </CardDescription>
+ </CardHeader>
+ <CardAction className="py-6">
+ {purchasingTermsStatus === "draft" ? (
+ <Badge variant="secondary">Draft</Badge>
+ ) : (
+ <LuCircleCheck className="w-4 h-4 text-emerald-500" />
+ )}
+ </CardAction>
+ </HStack>
+ <CardContent>
+ {permissions.can("update", "settings") ? (
+ <Editor
+ initialValue={(terms.purchasingTerms ?? {}) as JSONContent}
+ onUpload={onUploadImage}
+ onChange={handleUpdatePurchasingTerms}
+ />
+ ) : (
+ <div
+ className="prose dark:prose-invert"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(terms.purchasingTerms as JSONContent)
+ }}
+ />
+ )}
+ </CardContent>
+ </Card>
+ <Card>
+ <CardHeader>
+ <HStack className="justify-between items-center">
+ <div>
+ <CardTitle>Accounts Payable Billing Address</CardTitle>
+ <CardDescription>
+ The billing address used on purchase orders and other
+ purchasing documents.
+ </CardDescription>
+ </div>
+ <Switch
+ checked={apAddressEnabled}
+ onCheckedChange={handleApAddressToggle}
+ disabled={toggleFetcher.state !== "idle"}
+ />
+ </HStack>
+ </CardHeader>
+ </Card>
+ {apAddressEnabled && (
+ <Card>
+ <ValidatedForm
+ method="post"
+ validator={accountsPayableBillingAddressValidator}
+ defaultValues={{
+ name: apBillingAddress?.name ?? "",
+ addressLine1: apBillingAddress?.addressLine1 ?? "",
+ addressLine2: apBillingAddress?.addressLine2 ?? "",
+ city: apBillingAddress?.city ?? "",
+ state: apBillingAddress?.state ?? "",
+ postalCode: apBillingAddress?.postalCode ?? "",
+ countryCode: apBillingAddress?.countryCode ?? "",
+ phone: apBillingAddress?.phone ?? "",
+ fax: apBillingAddress?.fax ?? "",
+ email: apBillingAddress?.email ?? ""
+ }}
+ fetcher={fetcher}
+ >
+ <input
+ type="hidden"
+ name="intent"
+ value="accountsPayableBillingAddress"
+ />
+ <CardHeader>
+ <CardTitle>Billing Address</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="grid grid-cols-2 gap-4 w-full">
+ <Input name="name" label="Name" />
+ <Input name="email" label="Email" />
+ <Input name="addressLine1" label="Address Line 1" />
+ <Input name="addressLine2" label="Address Line 2" />
+ <Input name="city" label="City" />
+ <Input name="state" label="State / Province" />
+ <Input name="postalCode" label="Postal Code" />
+ <Country name="countryCode" />
+ <Input name="phone" label="Phone" />
+ <Input name="fax" label="Fax" />
+ </div>
+ </CardContent>
+ <CardFooter>
+ <Submit
+ isDisabled={fetcher.state !== "idle"}
+ isLoading={
+ fetcher.state !== "idle" &&
+ fetcher.formData?.get("intent") ===
+ "accountsPayableBillingAddress"
+ }
+ >
+ Save
+ </Submit>
+ </CardFooter>
+ </ValidatedForm>
+ </Card>
+ )}
+
<Card>
<ValidatedForm
method="post"
@@ -431,39 +614,6 @@ export default function PurchasingSettingsRoute() {
</CardFooter>
</ValidatedForm>
</Card>
- <Card>
- <HStack className="justify-between items-start">
- <CardHeader>
- <CardTitle>Purchasing Terms &amp; Conditions</CardTitle>
- <CardDescription>
- Define the terms and conditions for purchase orders
- </CardDescription>
- </CardHeader>
- <CardAction className="py-6">
- {purchasingTermsStatus === "draft" ? (
- <Badge variant="secondary">Draft</Badge>
- ) : (
- <LuCircleCheck className="w-4 h-4 text-emerald-500" />
- )}
- </CardAction>
- </HStack>
- <CardContent>
- {permissions.can("update", "settings") ? (
- <Editor
- initialValue={(terms.purchasingTerms ?? {}) as JSONContent}
- onUpload={onUploadImage}
- onChange={handleUpdatePurchasingTerms}
- />
- ) : (
- <div
- className="prose dark:prose-invert"
- dangerouslySetInnerHTML={{
- __html: generateHTML(terms.purchasingTerms as JSONContent)
- }}
- />
- )}
- </CardContent>
- </Card>
</VStack>
</ScrollArea>
);
diff --git a/apps/erp/app/routes/x+/settings+/sales.tsx b/apps/erp/app/routes/x+/settings+/sales.tsx
index 72ea088cc3..7f763afa16 100644
--- a/apps/erp/app/routes/x+/settings+/sales.tsx
+++ b/apps/erp/app/routes/x+/settings+/sales.tsx
@@ -4,6 +4,7 @@ import { flash } from "@carbon/auth/session.server";
// biome-ignore lint/suspicious/noShadowRestrictedNames: suppressed due to migration
import {
Boolean,
+ Input,
Number,
Submit,
ValidatedForm,
@@ -25,26 +26,32 @@ import {
HStack,
Label,
ScrollArea,
+ Switch,
toast,
useDebounce,
VStack
} from "@carbon/react";
import { Editor } from "@carbon/react/Editor";
import { getLocalTimeZone, today } from "@internationalized/date";
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { LuCircleCheck } from "react-icons/lu";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { redirect, useFetcher, useLoaderData } from "react-router";
import { EmailRecipients, Users } from "~/components/Form";
+import Country from "~/components/Form/Country";
import { usePermissions, useUser } from "~/hooks";
import {
+ accountsReceivableBillingAddressValidator,
defaultCustomerCcValidator,
digitalQuoteValidator,
+ getAccountsReceivableBillingAddress,
getCompanySettings,
getTerms,
includeThumbnailsOnSalesPdfsValidator,
quoteLineCategoryMarkupsSettingsValidator,
rfqReadyValidator,
+ updateAccountsReceivableAddressSetting,
+ updateAccountsReceivableBillingAddress,
updateDefaultCustomerCc,
updateDigitalQuoteSetting,
updateQuoteLineCategoryMarkups,
@@ -64,9 +71,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
view: "settings"
});
- const [companySettings, terms] = await Promise.all([
+ const [companySettings, terms, arBillingAddress] = await Promise.all([
getCompanySettings(client, companyId),
- getTerms(client, companyId)
+ getTerms(client, companyId),
+ getAccountsReceivableBillingAddress(client, companyId)
]);
if (!companySettings.data)
throw redirect(
@@ -76,11 +84,15 @@ export async function loader({ request }: LoaderFunctionArgs) {
error(companySettings.error, "Failed to get company settings")
)
);
- return { companySettings: companySettings.data, terms: terms.data };
+ return {
+ companySettings: companySettings.data,
+ terms: terms.data,
+ arBillingAddress: arBillingAddress.data
+ };
}
export async function action({ request }: ActionFunctionArgs) {
- const { client, companyId } = await requirePermissions(request, {
+ const { client, companyId, userId } = await requirePermissions(request, {
update: "settings"
});
@@ -88,6 +100,21 @@ export async function action({ request }: ActionFunctionArgs) {
const intent = formData.get("intent");
switch (intent) {
+ case "accountsReceivableAddressToggle":
+ const arToggleEnabled = formData.get("enabled") === "true";
+ const arToggleResult = await updateAccountsReceivableAddressSetting(
+ client,
+ companyId,
+ arToggleEnabled
+ );
+ if (arToggleResult.error) {
+ return { success: false, message: arToggleResult.error.message };
+ }
+ return {
+ success: true,
+ message: `Accounts receivable billing address ${arToggleEnabled ? "enabled" : "disabled"}`
+ };
+
case "digitalQuote":
const validation = await validator(digitalQuoteValidator).validate(
formData
@@ -174,6 +201,31 @@ export async function action({ request }: ActionFunctionArgs) {
message: "Default category markups updated"
};
+ case "accountsReceivableBillingAddress":
+ const arBillingValidation = await validator(
+ accountsReceivableBillingAddressValidator
+ ).validate(formData);
+
+ if (arBillingValidation.error) {
+ return { success: false, message: "Invalid form data" };
+ }
+
+ const arBillingResult = await updateAccountsReceivableBillingAddress(
+ client,
+ companyId,
+ arBillingValidation.data,
+ userId
+ );
+
+ if (arBillingResult.error) {
+ return { success: false, message: arBillingResult.error.message };
+ }
+
+ return {
+ success: true,
+ message: "Accounts receivable billing address updated"
+ };
+
case "emails":
const defaultCustomerCcValidation = await validator(
defaultCustomerCcValidator
@@ -206,8 +258,28 @@ export async function action({ request }: ActionFunctionArgs) {
}
export default function SalesSettingsRoute() {
- const { companySettings, terms } = useLoaderData<typeof loader>();
+ const { companySettings, terms, arBillingAddress } =
+ useLoaderData<typeof loader>();
const fetcher = useFetcher<typeof action>();
+ const toggleFetcher = useFetcher<typeof action>();
+ const [arAddressEnabled, setArAddressEnabled] = useState(
+ companySettings.accountsReceivableAddress ?? false
+ );
+
+ const handleArAddressToggle = useCallback(
+ (checked: boolean) => {
+ setArAddressEnabled(checked);
+ toggleFetcher.submit(
+ {
+ intent: "accountsReceivableAddressToggle",
+ enabled: checked.toString()
+ },
+ { method: "POST" }
+ );
+ },
+ [toggleFetcher]
+ );
+
const [digitalQuoteEnabled, setDigitalQuoteEnabled] = useState(
companySettings.digitalQuoteEnabled ?? false
);
@@ -222,6 +294,15 @@ export default function SalesSettingsRoute() {
}
}, [fetcher.data?.message, fetcher.data?.success]);
+ useEffect(() => {
+ if (toggleFetcher.data?.success === true && toggleFetcher?.data?.message) {
+ toast.success(toggleFetcher.data.message);
+ }
+ if (toggleFetcher.data?.success === false && toggleFetcher?.data?.message) {
+ toast.error(toggleFetcher.data.message);
+ }
+ }, [toggleFetcher.data?.message, toggleFetcher.data?.success]);
+
const permissions = usePermissions();
const { carbon } = useCarbon();
const {
@@ -269,6 +350,114 @@ export default function SalesSettingsRoute() {
className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4"
>
<Heading size="h3">Sales</Heading>
+ <Card>
+ <HStack className="justify-between items-start">
+ <CardHeader>
+ <CardTitle>Sales Terms &amp; Conditions</CardTitle>
+ <CardDescription>
+ Define the terms and conditions for quotes and sales orders
+ </CardDescription>
+ </CardHeader>
+ <CardAction className="py-6">
+ {salesTermsStatus === "draft" ? (
+ <Badge variant="secondary">Draft</Badge>
+ ) : (
+ <LuCircleCheck className="w-4 h-4 text-emerald-500" />
+ )}
+ </CardAction>
+ </HStack>
+ <CardContent>
+ {permissions.can("update", "settings") ? (
+ <Editor
+ initialValue={(terms?.salesTerms ?? {}) as JSONContent}
+ onUpload={onUploadImage}
+ onChange={handleUpdateSalesTerms}
+ />
+ ) : (
+ <div
+ className="prose dark:prose-invert"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(terms?.salesTerms as JSONContent)
+ }}
+ />
+ )}
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader>
+ <HStack className="justify-between items-center">
+ <div>
+ <CardTitle>Accounts Receivable Billing Address</CardTitle>
+ <CardDescription>
+ The billing address used on quotes, sales orders, invoices,
+ and other sales documents.
+ </CardDescription>
+ </div>
+ <Switch
+ checked={arAddressEnabled}
+ onCheckedChange={handleArAddressToggle}
+ disabled={toggleFetcher.state !== "idle"}
+ />
+ </HStack>
+ </CardHeader>
+ </Card>
+ {arAddressEnabled && (
+ <Card>
+ <ValidatedForm
+ method="post"
+ validator={accountsReceivableBillingAddressValidator}
+ defaultValues={{
+ name: arBillingAddress?.name ?? "",
+ addressLine1: arBillingAddress?.addressLine1 ?? "",
+ addressLine2: arBillingAddress?.addressLine2 ?? "",
+ city: arBillingAddress?.city ?? "",
+ state: arBillingAddress?.state ?? "",
+ postalCode: arBillingAddress?.postalCode ?? "",
+ countryCode: arBillingAddress?.countryCode ?? "",
+ phone: arBillingAddress?.phone ?? "",
+ fax: arBillingAddress?.fax ?? "",
+ email: arBillingAddress?.email ?? ""
+ }}
+ fetcher={fetcher}
+ >
+ <input
+ type="hidden"
+ name="intent"
+ value="accountsReceivableBillingAddress"
+ />
+ <CardHeader>
+ <CardTitle>Billing Address</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="grid grid-cols-2 gap-4 w-full">
+ <Input name="name" label="Name" />
+ <Input name="email" label="Email" />
+ <Input name="addressLine1" label="Address Line 1" />
+ <Input name="addressLine2" label="Address Line 2" />
+ <Input name="city" label="City" />
+ <Input name="state" label="State / Province" />
+ <Input name="postalCode" label="Postal Code" />
+ <Country name="countryCode" />
+ <Input name="phone" label="Phone" />
+ <Input name="fax" label="Fax" />
+ </div>
+ </CardContent>
+ <CardFooter>
+ <Submit
+ isDisabled={fetcher.state !== "idle"}
+ isLoading={
+ fetcher.state !== "idle" &&
+ fetcher.formData?.get("intent") ===
+ "accountsReceivableBillingAddress"
+ }
+ >
+ Save
+ </Submit>
+ </CardFooter>
+ </ValidatedForm>
+ </Card>
+ )}
<Card>
<ValidatedForm
method="post"
@@ -458,39 +647,6 @@ export default function SalesSettingsRoute() {
companySettings={companySettings}
fetcher={fetcher}
/>
- <Card>
- <HStack className="justify-between items-start">
- <CardHeader>
- <CardTitle>Sales Terms &amp; Conditions</CardTitle>
- <CardDescription>
- Define the terms and conditions for quotes and sales orders
- </CardDescription>
- </CardHeader>
- <CardAction className="py-6">
- {salesTermsStatus === "draft" ? (
- <Badge variant="secondary">Draft</Badge>
- ) : (
- <LuCircleCheck className="w-4 h-4 text-emerald-500" />
- )}
- </CardAction>
- </HStack>
- <CardContent>
- {permissions.can("update", "settings") ? (
- <Editor
- initialValue={(terms?.salesTerms ?? {}) as JSONContent}
- onUpload={onUploadImage}
- onChange={handleUpdateSalesTerms}
- />
- ) : (
- <div
- className="prose dark:prose-invert"
- dangerouslySetInnerHTML={{
- __html: generateHTML(terms?.salesTerms as JSONContent)
- }}
- />
- )}
- </CardContent>
- </Card>
</VStack>
</ScrollArea>
);
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.accounting.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.accounting.tsx
index f7635250dc..78205124f8 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.accounting.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.accounting.tsx
@@ -1,82 +1,15 @@
-import { assertIsPost, error, success } from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { flash } from "@carbon/auth/session.server";
-import { validationError, validator } from "@carbon/form";
-import type { ActionFunctionArgs } from "react-router";
-import { data, redirect, useParams } from "react-router";
-import { useRouteData } from "~/hooks";
-import type { SupplierDetail } from "~/modules/purchasing";
-import {
- supplierAccountingValidator,
- updateSupplierAccounting
-} from "~/modules/purchasing";
-import SupplierAccountingForm from "~/modules/purchasing/ui/Supplier/SupplierAccountingForm";
+import type { LoaderFunctionArgs } from "react-router";
+import { redirect, useParams } from "react-router";
import { path } from "~/utils/path";
-export async function action({ request }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- create: "purchasing"
- });
- const formData = await request.formData();
- const validation = await validator(supplierAccountingValidator).validate(
- formData
- );
-
- if (validation.error) {
- return validationError(validation.error);
- }
-
- const { id, ...d } = validation.data;
-
- if (!id) {
- throw redirect(
- path.to.supplierAccounting(id),
- await flash(request, error(null, "Failed to update supplier accounting"))
- );
- }
-
- const update = await updateSupplierAccounting(client, {
- id,
- ...d,
- updatedBy: userId
- });
-
- if (update.error) {
- throw redirect(
- path.to.supplierAccounting(id),
- await flash(
- request,
- error(update.error, "Failed to update supplier accounting")
- )
- );
- }
-
- return data(
- null,
- await flash(request, success("Updated supplier accounting"))
- );
+export async function loader({ params }: LoaderFunctionArgs) {
+ const { supplierId } = params;
+ if (!supplierId) throw new Error("Could not find supplierId");
+ return redirect(path.to.supplierDetails(supplierId));
}
export default function SupplierAccountingRoute() {
const { supplierId } = useParams();
if (!supplierId) throw new Error("Could not find supplierId");
- const routeData = useRouteData<{ supplier: SupplierDetail }>(
- path.to.supplier(supplierId)
- );
-
- if (!routeData?.supplier) return null;
-
- const initialValues = {
- id: routeData?.supplier?.id ?? undefined,
- supplierTypeId: routeData?.supplier?.supplierTypeId ?? undefined,
- taxId: routeData?.supplier?.taxId ?? ""
- };
-
- return (
- <SupplierAccountingForm
- key={initialValues.id}
- initialValues={initialValues}
- />
- );
+ return null;
}
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.details.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.details.tsx
index 822bc4aefd..2b13c7bd15 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.details.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.details.tsx
@@ -65,10 +65,10 @@ export default function SupplierEditRoute() {
supplierStatusId: routeData?.supplier?.supplierStatusId ?? undefined,
accountManagerId: routeData?.supplier?.accountManagerId ?? undefined,
taxId: routeData?.supplier?.taxId ?? "",
+ vatNumber: routeData?.supplier?.vatNumber ?? "",
currencyCode: routeData?.supplier?.currencyCode ?? undefined,
website: routeData?.supplier?.website ?? "",
purchasingContactId: routeData?.supplier?.purchasingContactId ?? undefined,
- invoicingContactId: routeData?.supplier?.invoicingContactId ?? undefined,
defaultCc: routeData?.supplier?.defaultCc ?? [],
...getCustomFields(routeData?.supplier?.customFields)
};
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 5edde84c3c..b0cc749cf6 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -3447,6 +3447,213 @@ export default {
tags: ["nonConformanceSalesOrderLine"],
},
},
+ "/companyAccountsPayableBillingAddress": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.city",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.state",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.postalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.countryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.phone",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.fax",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.email",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/companyAccountsPayableBillingAddress",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["companyAccountsPayableBillingAddress"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.companyAccountsPayableBillingAddress",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["companyAccountsPayableBillingAddress"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.city",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.state",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.postalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.countryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.phone",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.fax",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.email",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["companyAccountsPayableBillingAddress"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.addressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.city",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.state",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.postalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.countryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.phone",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.fax",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.email",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsPayableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/body.companyAccountsPayableBillingAddress",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["companyAccountsPayableBillingAddress"],
+ },
+ },
"/customerShipping": {
get: {
parameters: [
@@ -5634,6 +5841,24 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderLocations.supplierCountryName",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.supplierTaxId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.supplierVatNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.supplierContactName",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.supplierContactEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.companyCountryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLocations.companyCountryName",
+ },
{
$ref: "#/parameters/rowFilter.purchaseOrderLocations.deliveryName",
},
@@ -12918,6 +13143,30 @@ export default {
{
$ref: "#/parameters/rowFilter.salesInvoiceLocations.invoiceCountryName",
},
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentCustomerName",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentAddressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentAddressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentCity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentStateProvince",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentPostalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentCountryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.salesInvoiceLocations.shipmentCountryName",
+ },
{
$ref: "#/parameters/select",
},
@@ -13797,6 +14046,9 @@ export default {
{
$ref: "#/parameters/rowFilter.customers.taxPercent",
},
+ {
+ $ref: "#/parameters/rowFilter.customers.tags",
+ },
{
$ref: "#/parameters/rowFilter.customers.website",
},
@@ -13825,10 +14077,10 @@ export default {
$ref: "#/parameters/rowFilter.customers.salesContactId",
},
{
- $ref: "#/parameters/rowFilter.customers.invoicingContactId",
+ $ref: "#/parameters/rowFilter.customers.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.customers.defaultCc",
+ $ref: "#/parameters/rowFilter.customers.vatNumber",
},
{
$ref: "#/parameters/rowFilter.customers.externalId",
@@ -15826,97 +16078,112 @@ export default {
$ref: "#/parameters/rowFilter.companies.ownerId",
},
{
- $ref: "#/parameters/rowFilter.companies.userId",
+ $ref: "#/parameters/rowFilter.companies.createdAt",
},
{
- $ref: "#/parameters/rowFilter.companies.companyId",
+ $ref: "#/parameters/rowFilter.companies.suggestionNotificationGroup",
},
{
- $ref: "#/parameters/rowFilter.companies.role",
+ $ref: "#/parameters/rowFilter.companies.auditLogEnabled",
},
{
- $ref: "#/parameters/rowFilter.companies.employeeType",
+ $ref: "#/parameters/rowFilter.companies.vatNumber",
},
{
- $ref: "#/parameters/select",
- },
- {
- $ref: "#/parameters/order",
+ $ref: "#/parameters/rowFilter.companies.countryName",
},
{
- $ref: "#/parameters/range",
- },
- {
- $ref: "#/parameters/rangeUnit",
- },
- {
- $ref: "#/parameters/offset",
- },
- {
- $ref: "#/parameters/limit",
- },
- {
- $ref: "#/parameters/preferCount",
- },
- ],
- responses: {
- "200": {
- description: "OK",
- schema: {
- items: {
- $ref: "#/definitions/companies",
- },
- type: "array",
- },
- },
- "206": {
- description: "Partial Content",
- },
- },
- tags: ["companies"],
- },
- },
- "/process": {
- get: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.process.id",
- },
- {
- $ref: "#/parameters/rowFilter.process.name",
- },
- {
- $ref: "#/parameters/rowFilter.process.defaultStandardFactor",
- },
- {
- $ref: "#/parameters/rowFilter.process.companyId",
- },
- {
- $ref: "#/parameters/rowFilter.process.customFields",
- },
- {
- $ref: "#/parameters/rowFilter.process.createdBy",
- },
- {
- $ref: "#/parameters/rowFilter.process.createdAt",
- },
- {
- $ref: "#/parameters/rowFilter.process.updatedBy",
- },
- {
- $ref: "#/parameters/rowFilter.process.updatedAt",
- },
- {
- $ref: "#/parameters/rowFilter.process.processType",
+ $ref: "#/parameters/rowFilter.companies.userId",
},
{
- $ref: "#/parameters/rowFilter.process.tags",
+ $ref: "#/parameters/rowFilter.companies.companyId",
},
{
- $ref: "#/parameters/rowFilter.process.completeAllOnScan",
+ $ref: "#/parameters/rowFilter.companies.role",
},
{
- $ref: "#/parameters/rowFilter.process.active",
+ $ref: "#/parameters/rowFilter.companies.employeeType",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/companies",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["companies"],
+ },
+ },
+ "/process": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.process.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.defaultStandardFactor",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.processType",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.tags",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.completeAllOnScan",
+ },
+ {
+ $ref: "#/parameters/rowFilter.process.active",
},
{
$ref: "#/parameters/select",
@@ -26325,6 +26592,12 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderLine.taxAmount",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.requestedDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.receivedDate",
+ },
{
$ref: "#/parameters/select",
},
@@ -26519,6 +26792,12 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderLine.taxAmount",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.requestedDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.receivedDate",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -26667,6 +26946,12 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderLine.taxAmount",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.requestedDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLine.receivedDate",
+ },
{
$ref: "#/parameters/body.purchaseOrderLine",
},
@@ -31272,6 +31557,9 @@ export default {
{
$ref: "#/parameters/rowFilter.suppliers.currencyCode",
},
+ {
+ $ref: "#/parameters/rowFilter.suppliers.vatNumber",
+ },
{
$ref: "#/parameters/rowFilter.suppliers.website",
},
@@ -31287,9 +31575,6 @@ export default {
{
$ref: "#/parameters/rowFilter.suppliers.purchasingContactId",
},
- {
- $ref: "#/parameters/rowFilter.suppliers.invoicingContactId",
- },
{
$ref: "#/parameters/rowFilter.suppliers.embedding",
},
@@ -39661,10 +39946,10 @@ export default {
$ref: "#/parameters/rowFilter.customer.salesContactId",
},
{
- $ref: "#/parameters/rowFilter.customer.invoicingContactId",
+ $ref: "#/parameters/rowFilter.customer.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.customer.defaultCc",
+ $ref: "#/parameters/rowFilter.customer.vatNumber",
},
{
$ref: "#/parameters/select",
@@ -39792,10 +40077,10 @@ export default {
$ref: "#/parameters/rowFilter.customer.salesContactId",
},
{
- $ref: "#/parameters/rowFilter.customer.invoicingContactId",
+ $ref: "#/parameters/rowFilter.customer.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.customer.defaultCc",
+ $ref: "#/parameters/rowFilter.customer.vatNumber",
},
{
$ref: "#/parameters/preferReturn",
@@ -39877,10 +40162,10 @@ export default {
$ref: "#/parameters/rowFilter.customer.salesContactId",
},
{
- $ref: "#/parameters/rowFilter.customer.invoicingContactId",
+ $ref: "#/parameters/rowFilter.customer.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.customer.defaultCc",
+ $ref: "#/parameters/rowFilter.customer.vatNumber",
},
{
$ref: "#/parameters/body.customer",
@@ -45657,6 +45942,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLinePrice.categoryMarkups",
+ },
{
$ref: "#/parameters/select",
},
@@ -45770,6 +46058,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLinePrice.categoryMarkups",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -45837,6 +46128,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLinePrice.categoryMarkups",
+ },
{
$ref: "#/parameters/body.quoteLinePrice",
},
@@ -49485,6 +49779,9 @@ export default {
{
$ref: "#/parameters/rowFilter.company.auditLogEnabled",
},
+ {
+ $ref: "#/parameters/rowFilter.company.vatNumber",
+ },
{
$ref: "#/parameters/select",
},
@@ -49616,6 +49913,9 @@ export default {
{
$ref: "#/parameters/rowFilter.company.auditLogEnabled",
},
+ {
+ $ref: "#/parameters/rowFilter.company.vatNumber",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -49701,6 +50001,9 @@ export default {
{
$ref: "#/parameters/rowFilter.company.auditLogEnabled",
},
+ {
+ $ref: "#/parameters/rowFilter.company.vatNumber",
+ },
{
$ref: "#/parameters/body.company",
},
@@ -50088,188 +50391,395 @@ export default {
tags: ["user"],
},
},
- "/externalLink": {
+ "/companyAccountsReceivableBillingAddress": {
get: {
parameters: [
{
- $ref: "#/parameters/rowFilter.externalLink.id",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.documentType",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.documentId",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.customerId",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.createdAt",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.expiresAt",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.companyId",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.supplierId",
- },
- {
- $ref: "#/parameters/select",
- },
- {
- $ref: "#/parameters/order",
- },
- {
- $ref: "#/parameters/range",
- },
- {
- $ref: "#/parameters/rangeUnit",
- },
- {
- $ref: "#/parameters/offset",
- },
- {
- $ref: "#/parameters/limit",
- },
- {
- $ref: "#/parameters/preferCount",
- },
- ],
- responses: {
- "200": {
- description: "OK",
- schema: {
- items: {
- $ref: "#/definitions/externalLink",
- },
- type: "array",
- },
- },
- "206": {
- description: "Partial Content",
- },
- },
- tags: ["externalLink"],
- },
- post: {
- parameters: [
- {
- $ref: "#/parameters/body.externalLink",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.id",
},
{
- $ref: "#/parameters/select",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.name",
},
{
- $ref: "#/parameters/preferPost",
- },
- ],
- responses: {
- "201": {
- description: "Created",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine1",
},
- },
- tags: ["externalLink"],
- },
- delete: {
- parameters: [
{
- $ref: "#/parameters/rowFilter.externalLink.id",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine2",
},
{
- $ref: "#/parameters/rowFilter.externalLink.documentType",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.city",
},
{
- $ref: "#/parameters/rowFilter.externalLink.documentId",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.state",
},
{
- $ref: "#/parameters/rowFilter.externalLink.customerId",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.postalCode",
},
{
- $ref: "#/parameters/rowFilter.externalLink.createdAt",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.countryCode",
},
{
- $ref: "#/parameters/rowFilter.externalLink.expiresAt",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.phone",
},
{
- $ref: "#/parameters/rowFilter.externalLink.companyId",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.fax",
},
{
- $ref: "#/parameters/rowFilter.externalLink.supplierId",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.email",
},
{
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["externalLink"],
- },
- patch: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.externalLink.id",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.documentType",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.documentId",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedAt",
},
{
- $ref: "#/parameters/rowFilter.externalLink.customerId",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.createdAt",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.expiresAt",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.companyId",
- },
- {
- $ref: "#/parameters/rowFilter.externalLink.supplierId",
- },
- {
- $ref: "#/parameters/body.externalLink",
- },
- {
- $ref: "#/parameters/preferReturn",
- },
- ],
- responses: {
- "204": {
- description: "No Content",
- },
- },
- tags: ["externalLink"],
- },
- },
- "/supplierLocation": {
- get: {
- parameters: [
- {
- $ref: "#/parameters/rowFilter.supplierLocation.id",
- },
- {
- $ref: "#/parameters/rowFilter.supplierLocation.supplierId",
- },
- {
- $ref: "#/parameters/rowFilter.supplierLocation.addressId",
- },
- {
- $ref: "#/parameters/rowFilter.supplierLocation.customFields",
- },
- {
- $ref: "#/parameters/rowFilter.supplierLocation.name",
- },
- {
- $ref: "#/parameters/rowFilter.supplierLocation.tags",
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/companyAccountsReceivableBillingAddress",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["companyAccountsReceivableBillingAddress"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.companyAccountsReceivableBillingAddress",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["companyAccountsReceivableBillingAddress"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.city",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.state",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.postalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.countryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.phone",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.fax",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.email",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["companyAccountsReceivableBillingAddress"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine1",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.addressLine2",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.city",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.state",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.postalCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.countryCode",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.phone",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.fax",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.email",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companyAccountsReceivableBillingAddress.updatedBy",
+ },
+ {
+ $ref: "#/parameters/body.companyAccountsReceivableBillingAddress",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["companyAccountsReceivableBillingAddress"],
+ },
+ },
+ "/externalLink": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.externalLink.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentType",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.customerId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.expiresAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.supplierId",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/externalLink",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["externalLink"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.externalLink",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["externalLink"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.externalLink.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentType",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.customerId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.expiresAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.supplierId",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["externalLink"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.externalLink.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentType",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.documentId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.customerId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.expiresAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.externalLink.supplierId",
+ },
+ {
+ $ref: "#/parameters/body.externalLink",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["externalLink"],
+ },
+ },
+ "/supplierLocation": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.addressId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.name",
+ },
+ {
+ $ref: "#/parameters/rowFilter.supplierLocation.tags",
},
{
$ref: "#/parameters/select",
@@ -53340,6 +53850,12 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderLines.taxAmount",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLines.requestedDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrderLines.receivedDate",
+ },
{
$ref: "#/parameters/rowFilter.purchaseOrderLines.thumbnailPath",
},
@@ -55515,6 +56031,12 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrders.supplierShippingCost",
},
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrders.createdByFullName",
+ },
+ {
+ $ref: "#/parameters/rowFilter.purchaseOrders.createdByEmail",
+ },
{
$ref: "#/parameters/select",
},
@@ -55705,10 +56227,10 @@ export default {
$ref: "#/parameters/rowFilter.supplier.purchasingContactId",
},
{
- $ref: "#/parameters/rowFilter.supplier.invoicingContactId",
+ $ref: "#/parameters/rowFilter.supplier.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.supplier.defaultCc",
+ $ref: "#/parameters/rowFilter.supplier.vatNumber",
},
{
$ref: "#/parameters/select",
@@ -55836,10 +56358,10 @@ export default {
$ref: "#/parameters/rowFilter.supplier.purchasingContactId",
},
{
- $ref: "#/parameters/rowFilter.supplier.invoicingContactId",
+ $ref: "#/parameters/rowFilter.supplier.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.supplier.defaultCc",
+ $ref: "#/parameters/rowFilter.supplier.vatNumber",
},
{
$ref: "#/parameters/preferReturn",
@@ -55921,10 +56443,10 @@ export default {
$ref: "#/parameters/rowFilter.supplier.purchasingContactId",
},
{
- $ref: "#/parameters/rowFilter.supplier.invoicingContactId",
+ $ref: "#/parameters/rowFilter.supplier.defaultCc",
},
{
- $ref: "#/parameters/rowFilter.supplier.defaultCc",
+ $ref: "#/parameters/rowFilter.supplier.vatNumber",
},
{
$ref: "#/parameters/body.supplier",
@@ -62277,6 +62799,21 @@ export default {
{
$ref: "#/parameters/rowFilter.companySettings.jobTravelerIncludeWorkInstructions",
},
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.quoteLineCategoryMarkups",
+ },
{
$ref: "#/parameters/select",
},
@@ -62414,6 +62951,21 @@ export default {
{
$ref: "#/parameters/rowFilter.companySettings.jobTravelerIncludeWorkInstructions",
},
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.quoteLineCategoryMarkups",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -62505,6 +63057,21 @@ export default {
{
$ref: "#/parameters/rowFilter.companySettings.jobTravelerIncludeWorkInstructions",
},
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableEmail",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsPayableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.accountsReceivableAddress",
+ },
+ {
+ $ref: "#/parameters/rowFilter.companySettings.quoteLineCategoryMarkups",
+ },
{
$ref: "#/parameters/body.companySettings",
},
@@ -70468,6 +71035,67 @@ export default {
},
type: "object",
},
+ companyAccountsPayableBillingAddress: {
+ required: ["id"],
+ properties: {
+ id: {
+ description:
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ name: {
+ default: "Accounts Payable",
+ format: "text",
+ type: "string",
+ },
+ addressLine1: {
+ format: "text",
+ type: "string",
+ },
+ addressLine2: {
+ format: "text",
+ type: "string",
+ },
+ city: {
+ format: "text",
+ type: "string",
+ },
+ state: {
+ format: "text",
+ type: "string",
+ },
+ postalCode: {
+ format: "text",
+ type: "string",
+ },
+ countryCode: {
+ format: "text",
+ type: "string",
+ },
+ phone: {
+ format: "text",
+ type: "string",
+ },
+ fax: {
+ format: "text",
+ type: "string",
+ },
+ email: {
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
customerShipping: {
required: ["customerId", "companyId"],
properties: {
@@ -71439,6 +72067,30 @@ export default {
format: "text",
type: "string",
},
+ supplierTaxId: {
+ format: "text",
+ type: "string",
+ },
+ supplierVatNumber: {
+ format: "text",
+ type: "string",
+ },
+ supplierContactName: {
+ format: "text",
+ type: "string",
+ },
+ supplierContactEmail: {
+ format: "text",
+ type: "string",
+ },
+ companyCountryCode: {
+ format: "text",
+ type: "string",
+ },
+ companyCountryName: {
+ format: "text",
+ type: "string",
+ },
deliveryName: {
format: "text",
type: "string",
@@ -75092,6 +75744,40 @@ export default {
format: "text",
type: "string",
},
+ shipmentCustomerName: {
+ format: "text",
+ type: "string",
+ },
+ shipmentAddressLine1: {
+ format: "text",
+ type: "string",
+ },
+ shipmentAddressLine2: {
+ format: "text",
+ type: "string",
+ },
+ shipmentCity: {
+ format: "text",
+ type: "string",
+ },
+ shipmentStateProvince: {
+ format: "text",
+ type: "string",
+ },
+ shipmentPostalCode: {
+ format: "text",
+ type: "string",
+ },
+ shipmentCountryCode: {
+ description:
+ "Note:\nThis is a Foreign Key to `country.alpha2`.<fk table='country' column='alpha2'/>",
+ format: "text",
+ type: "string",
+ },
+ shipmentCountryName: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -75488,6 +76174,13 @@ export default {
format: "numeric",
type: "number",
},
+ tags: {
+ format: "text[]",
+ items: {
+ type: "string",
+ },
+ type: "array",
+ },
website: {
format: "text",
type: "string",
@@ -75533,12 +76226,6 @@ export default {
format: "text",
type: "string",
},
- invoicingContactId: {
- description:
- "Note:\nThis is a Foreign Key to `customerContact.id`.<fk table='customerContact' column='id'/>",
- format: "text",
- type: "string",
- },
defaultCc: {
format: "text[]",
items: {
@@ -75546,6 +76233,10 @@ export default {
},
type: "array",
},
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
externalId: {
format: "jsonb",
},
@@ -76465,6 +77156,29 @@ export default {
format: "text",
type: "string",
},
+ createdAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ suggestionNotificationGroup: {
+ format: "text[]",
+ items: {
+ type: "string",
+ },
+ type: "array",
+ },
+ auditLogEnabled: {
+ format: "boolean",
+ type: "boolean",
+ },
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
+ countryName: {
+ format: "text",
+ type: "string",
+ },
userId: {
description:
"Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
@@ -81205,6 +81919,14 @@ export default {
format: "numeric",
type: "number",
},
+ requestedDate: {
+ format: "date",
+ type: "string",
+ },
+ receivedDate: {
+ format: "date",
+ type: "string",
+ },
},
type: "object",
},
@@ -83425,6 +84147,10 @@ export default {
format: "text",
type: "string",
},
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
website: {
format: "text",
type: "string",
@@ -83449,12 +84175,6 @@ export default {
format: "text",
type: "string",
},
- invoicingContactId: {
- description:
- "Note:\nThis is a Foreign Key to `supplierContact.id`.<fk table='supplierContact' column='id'/>",
- format: "text",
- type: "string",
- },
embedding: {
format: "extensions.halfvec(384)",
type: "string",
@@ -87258,12 +87978,6 @@ export default {
format: "text",
type: "string",
},
- invoicingContactId: {
- description:
- "Note:\nThis is a Foreign Key to `customerContact.id`.<fk table='customerContact' column='id'/>",
- format: "text",
- type: "string",
- },
defaultCc: {
format: "text[]",
items: {
@@ -87271,6 +87985,10 @@ export default {
},
type: "array",
},
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -90364,6 +91082,9 @@ export default {
format: "numeric",
type: "number",
},
+ categoryMarkups: {
+ format: "jsonb",
+ },
},
type: "object",
},
@@ -92246,6 +92967,10 @@ export default {
format: "boolean",
type: "boolean",
},
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -92448,6 +93173,67 @@ export default {
},
type: "object",
},
+ companyAccountsReceivableBillingAddress: {
+ required: ["id"],
+ properties: {
+ id: {
+ description:
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ name: {
+ default: "Accounts Receivable",
+ format: "text",
+ type: "string",
+ },
+ addressLine1: {
+ format: "text",
+ type: "string",
+ },
+ addressLine2: {
+ format: "text",
+ type: "string",
+ },
+ city: {
+ format: "text",
+ type: "string",
+ },
+ state: {
+ format: "text",
+ type: "string",
+ },
+ postalCode: {
+ format: "text",
+ type: "string",
+ },
+ countryCode: {
+ format: "text",
+ type: "string",
+ },
+ phone: {
+ format: "text",
+ type: "string",
+ },
+ fax: {
+ format: "text",
+ type: "string",
+ },
+ email: {
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
externalLink: {
required: ["id", "documentType", "documentId", "createdAt", "companyId"],
properties: {
@@ -94066,6 +94852,14 @@ export default {
format: "numeric",
type: "number",
},
+ requestedDate: {
+ format: "date",
+ type: "string",
+ },
+ receivedDate: {
+ format: "date",
+ type: "string",
+ },
thumbnailPath: {
format: "text",
type: "string",
@@ -95114,6 +95908,14 @@ export default {
format: "numeric",
type: "number",
},
+ createdByFullName: {
+ format: "text",
+ type: "string",
+ },
+ createdByEmail: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -95307,12 +96109,6 @@ export default {
format: "text",
type: "string",
},
- invoicingContactId: {
- description:
- "Note:\nThis is a Foreign Key to `supplierContact.id`.<fk table='supplierContact' column='id'/>",
- format: "text",
- type: "string",
- },
defaultCc: {
format: "text[]",
items: {
@@ -95320,6 +96116,10 @@ export default {
},
type: "array",
},
+ vatNumber: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -98634,6 +99434,27 @@ export default {
format: "boolean",
type: "boolean",
},
+ accountsPayableEmail: {
+ format: "text",
+ type: "string",
+ },
+ accountsReceivableEmail: {
+ format: "text",
+ type: "string",
+ },
+ accountsPayableAddress: {
+ default: false,
+ format: "boolean",
+ type: "boolean",
+ },
+ accountsReceivableAddress: {
+ default: false,
+ format: "boolean",
+ type: "boolean",
+ },
+ quoteLineCategoryMarkups: {
+ format: "jsonb",
+ },
},
type: "object",
},
@@ -100924,6 +101745,93 @@ export default {
in: "query",
type: "string",
},
+ "body.companyAccountsPayableBillingAddress": {
+ name: "companyAccountsPayableBillingAddress",
+ description: "companyAccountsPayableBillingAddress",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/companyAccountsPayableBillingAddress",
+ },
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.name": {
+ name: "name",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.addressLine1": {
+ name: "addressLine1",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.addressLine2": {
+ name: "addressLine2",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.city": {
+ name: "city",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.state": {
+ name: "state",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.postalCode": {
+ name: "postalCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.countryCode": {
+ name: "countryCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.phone": {
+ name: "phone",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.fax": {
+ name: "fax",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.email": {
+ name: "email",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsPayableBillingAddress.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.customerShipping": {
name: "customerShipping",
description: "customerShipping",
@@ -102013,6 +102921,42 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.purchaseOrderLocations.supplierTaxId": {
+ name: "supplierTaxId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLocations.supplierVatNumber": {
+ name: "supplierVatNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLocations.supplierContactName": {
+ name: "supplierContactName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLocations.supplierContactEmail": {
+ name: "supplierContactEmail",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLocations.companyCountryCode": {
+ name: "companyCountryCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLocations.companyCountryName": {
+ name: "companyCountryName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.purchaseOrderLocations.deliveryName": {
name: "deliveryName",
required: false,
@@ -106198,6 +107142,54 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.salesInvoiceLocations.shipmentCustomerName": {
+ name: "shipmentCustomerName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentAddressLine1": {
+ name: "shipmentAddressLine1",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentAddressLine2": {
+ name: "shipmentAddressLine2",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentCity": {
+ name: "shipmentCity",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentStateProvince": {
+ name: "shipmentStateProvince",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentPostalCode": {
+ name: "shipmentPostalCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentCountryCode": {
+ name: "shipmentCountryCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.salesInvoiceLocations.shipmentCountryName": {
+ name: "shipmentCountryName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.itemLedger": {
name: "itemLedger",
description: "itemLedger",
@@ -106597,6 +107589,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.customers.tags": {
+ name: "tags",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.customers.website": {
name: "website",
required: false,
@@ -106651,14 +107649,14 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.customers.invoicingContactId": {
- name: "invoicingContactId",
+ "rowFilter.customers.defaultCc": {
+ name: "defaultCc",
required: false,
in: "query",
type: "string",
},
- "rowFilter.customers.defaultCc": {
- name: "defaultCc",
+ "rowFilter.customers.vatNumber": {
+ name: "vatNumber",
required: false,
in: "query",
type: "string",
@@ -107704,6 +108702,36 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.companies.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companies.suggestionNotificationGroup": {
+ name: "suggestionNotificationGroup",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companies.auditLogEnabled": {
+ name: "auditLogEnabled",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companies.vatNumber": {
+ name: "vatNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companies.countryName": {
+ name: "countryName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.companies.userId": {
name: "userId",
required: false,
@@ -113065,6 +114093,18 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.purchaseOrderLine.requestedDate": {
+ name: "requestedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLine.receivedDate": {
+ name: "receivedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.stockTransferLines": {
name: "stockTransferLines",
description: "stockTransferLines",
@@ -115476,6 +116516,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.suppliers.vatNumber": {
+ name: "vatNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.suppliers.website": {
name: "website",
required: false,
@@ -115506,12 +116552,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.suppliers.invoicingContactId": {
- name: "invoicingContactId",
- required: false,
- in: "query",
- type: "string",
- },
"rowFilter.suppliers.embedding": {
name: "embedding",
required: false,
@@ -119818,14 +120858,14 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.customer.invoicingContactId": {
- name: "invoicingContactId",
+ "rowFilter.customer.defaultCc": {
+ name: "defaultCc",
required: false,
in: "query",
type: "string",
},
- "rowFilter.customer.defaultCc": {
- name: "defaultCc",
+ "rowFilter.customer.vatNumber": {
+ name: "vatNumber",
required: false,
in: "query",
type: "string",
@@ -123451,6 +124491,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.quoteLinePrice.categoryMarkups": {
+ name: "categoryMarkups",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.attributeDataType": {
name: "attributeDataType",
description: "attributeDataType",
@@ -125493,6 +126539,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.company.vatNumber": {
+ name: "vatNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.salesOrderLocations": {
name: "salesOrderLocations",
description: "salesOrderLocations",
@@ -125748,6 +126800,93 @@ export default {
in: "query",
type: "string",
},
+ "body.companyAccountsReceivableBillingAddress": {
+ name: "companyAccountsReceivableBillingAddress",
+ description: "companyAccountsReceivableBillingAddress",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/companyAccountsReceivableBillingAddress",
+ },
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.name": {
+ name: "name",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.addressLine1": {
+ name: "addressLine1",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.addressLine2": {
+ name: "addressLine2",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.city": {
+ name: "city",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.state": {
+ name: "state",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.postalCode": {
+ name: "postalCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.countryCode": {
+ name: "countryCode",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.phone": {
+ name: "phone",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.fax": {
+ name: "fax",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.email": {
+ name: "email",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companyAccountsReceivableBillingAddress.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.externalLink": {
name: "externalLink",
description: "externalLink",
@@ -127533,6 +128672,18 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.purchaseOrderLines.requestedDate": {
+ name: "requestedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrderLines.receivedDate": {
+ name: "receivedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.purchaseOrderLines.thumbnailPath": {
name: "thumbnailPath",
required: false,
@@ -128727,6 +129878,18 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.purchaseOrders.createdByFullName": {
+ name: "createdByFullName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.purchaseOrders.createdByEmail": {
+ name: "createdByEmail",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.openSalesOrderLines": {
name: "openSalesOrderLines",
description: "openSalesOrderLines",
@@ -128955,14 +130118,14 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.supplier.invoicingContactId": {
- name: "invoicingContactId",
+ "rowFilter.supplier.defaultCc": {
+ name: "defaultCc",
required: false,
in: "query",
type: "string",
},
- "rowFilter.supplier.defaultCc": {
- name: "defaultCc",
+ "rowFilter.supplier.vatNumber": {
+ name: "vatNumber",
required: false,
in: "query",
type: "string",
@@ -132594,6 +133757,36 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.companySettings.accountsPayableEmail": {
+ name: "accountsPayableEmail",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companySettings.accountsReceivableEmail": {
+ name: "accountsReceivableEmail",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companySettings.accountsPayableAddress": {
+ name: "accountsPayableAddress",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companySettings.accountsReceivableAddress": {
+ name: "accountsReceivableAddress",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.companySettings.quoteLineCategoryMarkups": {
+ name: "quoteLineCategoryMarkups",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.part": {
name: "part",
description: "part",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 3c05d53a43..12499de0ca 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -4333,7 +4333,6 @@ export type Database = {
name: string
phone: string | null
salesContactId: string | null
- salesLocationId: string | null
tags: string[] | null
taxId: string | null
taxPercent: number
@@ -4360,7 +4359,6 @@ export type Database = {
name: string
phone?: string | null
salesContactId?: string | null
- salesLocationId?: string | null
tags?: string[] | null
taxId?: string | null
taxPercent?: number
@@ -4387,7 +4385,6 @@ export type Database = {
name?: string
phone?: string | null
salesContactId?: string | null
- salesLocationId?: string | null
tags?: string[] | null
taxId?: string | null
taxPercent?: number
@@ -4558,13 +4555,6 @@ export type Database = {
referencedRelation: "customerContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "customer_salesLocationId_fkey"
- columns: ["salesLocationId"]
- isOneToOne: false
- referencedRelation: "customerLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "customer_updatedBy_fkey"
columns: ["updatedBy"]
@@ -33318,48 +33308,6 @@ export type Database = {
},
]
}
- searchIndex_6c79NxG3ZDag1uLg7D2uMy: {
- Row: {
- createdAt: string
- description: string | null
- entityId: string
- entityType: string
- id: number
- link: string
- metadata: Json | null
- searchVector: unknown
- tags: string[] | null
- title: string
- updatedAt: string | null
- }
- Insert: {
- createdAt?: string
- description?: string | null
- entityId: string
- entityType: string
- id?: number
- link: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title: string
- updatedAt?: string | null
- }
- Update: {
- createdAt?: string
- description?: string | null
- entityId?: string
- entityType?: string
- id?: number
- link?: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title?: string
- updatedAt?: string | null
- }
- Relationships: []
- }
searchIndexRegistry: {
Row: {
companyId: string
@@ -35646,7 +35594,6 @@ export type Database = {
name: string
phone: string | null
purchasingContactId: string | null
- purchasingLocationId: string | null
supplierStatusId: string | null
supplierTypeId: string | null
tags: string[] | null
@@ -35673,7 +35620,6 @@ export type Database = {
name: string
phone?: string | null
purchasingContactId?: string | null
- purchasingLocationId?: string | null
supplierStatusId?: string | null
supplierTypeId?: string | null
tags?: string[] | null
@@ -35700,7 +35646,6 @@ export type Database = {
name?: string
phone?: string | null
purchasingContactId?: string | null
- purchasingLocationId?: string | null
supplierStatusId?: string | null
supplierTypeId?: string | null
tags?: string[] | null
@@ -35859,13 +35804,6 @@ export type Database = {
referencedRelation: "supplierContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "supplier_purchasingLocationId_fkey"
- columns: ["purchasingLocationId"]
- isOneToOne: false
- referencedRelation: "supplierLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "supplier_supplierStatusId_fkey"
columns: ["supplierStatusId"]
@@ -43802,7 +43740,6 @@ export type Database = {
orderCount: number | null
phone: string | null
salesContactId: string | null
- salesLocationId: string | null
status: string | null
tags: string[] | null
taxId: string | null
@@ -43975,13 +43912,6 @@ export type Database = {
referencedRelation: "customerContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "customer_salesLocationId_fkey"
- columns: ["salesLocationId"]
- isOneToOne: false
- referencedRelation: "customerLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "customer_updatedBy_fkey"
columns: ["updatedBy"]
@@ -47901,14 +47831,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -49269,6 +49199,8 @@ export type Database = {
}
purchaseOrderLocations: {
Row: {
+ companyCountryCode: string | null
+ companyCountryName: string | null
customerAddressLine1: string | null
customerAddressLine2: string | null
customerCity: string | null
@@ -52444,21 +52376,21 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["shipmentCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -55213,7 +55145,6 @@ export type Database = {
partCount: number | null
phone: string | null
purchasingContactId: string | null
- purchasingLocationId: string | null
status: string | null
supplierStatusId: string | null
supplierTypeId: string | null
@@ -55374,13 +55305,6 @@ export type Database = {
referencedRelation: "supplierContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "supplier_purchasingLocationId_fkey"
- columns: ["purchasingLocationId"]
- isOneToOne: false
- referencedRelation: "supplierLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "supplier_supplierStatusId_fkey"
columns: ["supplierStatusId"]
@@ -56170,6 +56094,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56209,6 +56134,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56248,6 +56174,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56626,6 +56553,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -57336,6 +57264,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 3c05d53a43..12499de0ca 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -4333,7 +4333,6 @@ export type Database = {
name: string
phone: string | null
salesContactId: string | null
- salesLocationId: string | null
tags: string[] | null
taxId: string | null
taxPercent: number
@@ -4360,7 +4359,6 @@ export type Database = {
name: string
phone?: string | null
salesContactId?: string | null
- salesLocationId?: string | null
tags?: string[] | null
taxId?: string | null
taxPercent?: number
@@ -4387,7 +4385,6 @@ export type Database = {
name?: string
phone?: string | null
salesContactId?: string | null
- salesLocationId?: string | null
tags?: string[] | null
taxId?: string | null
taxPercent?: number
@@ -4558,13 +4555,6 @@ export type Database = {
referencedRelation: "customerContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "customer_salesLocationId_fkey"
- columns: ["salesLocationId"]
- isOneToOne: false
- referencedRelation: "customerLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "customer_updatedBy_fkey"
columns: ["updatedBy"]
@@ -33318,48 +33308,6 @@ export type Database = {
},
]
}
- searchIndex_6c79NxG3ZDag1uLg7D2uMy: {
- Row: {
- createdAt: string
- description: string | null
- entityId: string
- entityType: string
- id: number
- link: string
- metadata: Json | null
- searchVector: unknown
- tags: string[] | null
- title: string
- updatedAt: string | null
- }
- Insert: {
- createdAt?: string
- description?: string | null
- entityId: string
- entityType: string
- id?: number
- link: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title: string
- updatedAt?: string | null
- }
- Update: {
- createdAt?: string
- description?: string | null
- entityId?: string
- entityType?: string
- id?: number
- link?: string
- metadata?: Json | null
- searchVector?: unknown
- tags?: string[] | null
- title?: string
- updatedAt?: string | null
- }
- Relationships: []
- }
searchIndexRegistry: {
Row: {
companyId: string
@@ -35646,7 +35594,6 @@ export type Database = {
name: string
phone: string | null
purchasingContactId: string | null
- purchasingLocationId: string | null
supplierStatusId: string | null
supplierTypeId: string | null
tags: string[] | null
@@ -35673,7 +35620,6 @@ export type Database = {
name: string
phone?: string | null
purchasingContactId?: string | null
- purchasingLocationId?: string | null
supplierStatusId?: string | null
supplierTypeId?: string | null
tags?: string[] | null
@@ -35700,7 +35646,6 @@ export type Database = {
name?: string
phone?: string | null
purchasingContactId?: string | null
- purchasingLocationId?: string | null
supplierStatusId?: string | null
supplierTypeId?: string | null
tags?: string[] | null
@@ -35859,13 +35804,6 @@ export type Database = {
referencedRelation: "supplierContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "supplier_purchasingLocationId_fkey"
- columns: ["purchasingLocationId"]
- isOneToOne: false
- referencedRelation: "supplierLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "supplier_supplierStatusId_fkey"
columns: ["supplierStatusId"]
@@ -43802,7 +43740,6 @@ export type Database = {
orderCount: number | null
phone: string | null
salesContactId: string | null
- salesLocationId: string | null
status: string | null
tags: string[] | null
taxId: string | null
@@ -43975,13 +43912,6 @@ export type Database = {
referencedRelation: "customerContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "customer_salesLocationId_fkey"
- columns: ["salesLocationId"]
- isOneToOne: false
- referencedRelation: "customerLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "customer_updatedBy_fkey"
columns: ["updatedBy"]
@@ -47901,14 +47831,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -49269,6 +49199,8 @@ export type Database = {
}
purchaseOrderLocations: {
Row: {
+ companyCountryCode: string | null
+ companyCountryName: string | null
customerAddressLine1: string | null
customerAddressLine2: string | null
customerCity: string | null
@@ -52444,21 +52376,21 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["shipmentCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -55213,7 +55145,6 @@ export type Database = {
partCount: number | null
phone: string | null
purchasingContactId: string | null
- purchasingLocationId: string | null
status: string | null
supplierStatusId: string | null
supplierTypeId: string | null
@@ -55374,13 +55305,6 @@ export type Database = {
referencedRelation: "supplierContact"
referencedColumns: ["id"]
},
- {
- foreignKeyName: "supplier_purchasingLocationId_fkey"
- columns: ["purchasingLocationId"]
- isOneToOne: false
- referencedRelation: "supplierLocation"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "supplier_supplierStatusId_fkey"
columns: ["supplierStatusId"]
@@ -56170,6 +56094,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56209,6 +56134,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56248,6 +56174,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -56626,6 +56553,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
@@ -57336,6 +57264,7 @@ export type Database = {
laborUnit: Database["public"]["Enums"]["factor"]
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
+ operationDueDate: string
operationOrder: number
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
operationQuantity: number
diff --git a/packages/database/supabase/functions/post-receipt/index.ts b/packages/database/supabase/functions/post-receipt/index.ts
index 9fcbdb4b3b..65f9355b93 100644
--- a/packages/database/supabase/functions/post-receipt/index.ts
+++ b/packages/database/supabase/functions/post-receipt/index.ts
@@ -274,6 +274,7 @@ serve(async (req: Request) => {
[purchaseOrderLine.id]: {
quantityReceived: newQuantityReceived,
receivedComplete,
+ receivedDate: today,
},
};
}
diff --git a/packages/database/supabase/migrations/20260304112615_purchasing-info.sql b/packages/database/supabase/migrations/20260304112615_purchasing-info.sql
new file mode 100644
index 0000000000..754d7017a0
--- /dev/null
+++ b/packages/database/supabase/migrations/20260304112615_purchasing-info.sql
@@ -0,0 +1,467 @@
+ALTER TABLE "companySettings" ADD COLUMN "accountsPayableEmail" TEXT;
+ALTER TABLE "companySettings" ADD COLUMN "accountsReceivableEmail" TEXT;
+
+ALTER TABLE "company" ADD COLUMN "vatNumber" TEXT;
+
+ALTER TABLE "customer" ADD COLUMN "vatNumber" TEXT;
+ALTER TABLE "supplier" ADD COLUMN "vatNumber" TEXT;
+
+
+DROP VIEW IF EXISTS "customers";
+DROP VIEW IF EXISTS "suppliers";
+
+ALTER TABLE "customer" DROP COLUMN IF EXISTS "invoicingContactId";
+ALTER TABLE "supplier" DROP COLUMN IF EXISTS "invoicingContactId";
+
+-- Recreate purchaseOrderLocations view to include supplier taxId and vatNumber
+DROP VIEW IF EXISTS "purchaseOrderLocations";
+CREATE OR REPLACE VIEW "purchaseOrderLocations" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ po.id,
+ s.name AS "supplierName",
+ sa."addressLine1" AS "supplierAddressLine1",
+ sa."addressLine2" AS "supplierAddressLine2",
+ sa."city" AS "supplierCity",
+ sa."stateProvince" AS "supplierStateProvince",
+ sa."postalCode" AS "supplierPostalCode",
+ sa."countryCode" AS "supplierCountryCode",
+ sc."name" AS "supplierCountryName",
+ s."taxId" AS "supplierTaxId",
+ s."vatNumber" AS "supplierVatNumber",
+ scon."fullName" AS "supplierContactName",
+ scon."email" AS "supplierContactEmail",
+ comp."countryCode" AS "companyCountryCode",
+ compc."name" AS "companyCountryName",
+ dl.name AS "deliveryName",
+ dl."addressLine1" AS "deliveryAddressLine1",
+ dl."addressLine2" AS "deliveryAddressLine2",
+ dl."city" AS "deliveryCity",
+ dl."stateProvince" AS "deliveryStateProvince",
+ dl."postalCode" AS "deliveryPostalCode",
+ dl."countryCode" AS "deliveryCountryCode",
+ dc."name" AS "deliveryCountryName",
+ pod."dropShipment",
+ c.name AS "customerName",
+ ca."addressLine1" AS "customerAddressLine1",
+ ca."addressLine2" AS "customerAddressLine2",
+ ca."city" AS "customerCity",
+ ca."stateProvince" AS "customerStateProvince",
+ ca."postalCode" AS "customerPostalCode",
+ ca."countryCode" AS "customerCountryCode",
+ cc."name" AS "customerCountryName"
+ FROM "purchaseOrder" po
+ LEFT OUTER JOIN "supplier" s
+ ON s.id = po."supplierId"
+ LEFT OUTER JOIN "supplierLocation" sl
+ ON sl.id = po."supplierLocationId"
+ LEFT OUTER JOIN "address" sa
+ ON sa.id = sl."addressId"
+ LEFT OUTER JOIN "country" sc
+ ON sc.alpha2 = sa."countryCode"
+ LEFT OUTER JOIN "supplierContact" sct
+ ON sct.id = po."supplierContactId"
+ LEFT OUTER JOIN "contact" scon
+ ON scon.id = sct."contactId"
+ LEFT OUTER JOIN "company" comp
+ ON comp.id = po."companyId"
+ LEFT OUTER JOIN "country" compc
+ ON compc.alpha2 = comp."countryCode"
+ INNER JOIN "purchaseOrderDelivery" pod
+ ON pod.id = po.id
+ LEFT OUTER JOIN "location" dl
+ ON dl.id = pod."locationId"
+ LEFT OUTER JOIN "country" dc
+ ON dc.alpha2 = dl."countryCode"
+ LEFT OUTER JOIN "customer" c
+ ON c.id = pod."customerId"
+ LEFT OUTER JOIN "customerLocation" cl
+ ON cl.id = pod."customerLocationId"
+ LEFT OUTER JOIN "address" ca
+ ON ca.id = cl."addressId"
+ LEFT OUTER JOIN "country" cc
+ ON cc.alpha2 = ca."countryCode";
+
+-- Recreate purchaseOrders view to include creator info
+DROP VIEW IF EXISTS "purchaseOrders";
+CREATE OR REPLACE VIEW "purchaseOrders" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ p.*,
+ pl."thumbnailPath",
+ pl."itemType",
+ pl."orderTotal" + pd."supplierShippingCost" * p."exchangeRate" AS "orderTotal",
+ pd."shippingMethodId",
+ pd."shippingTermId",
+ pd."receiptRequestedDate",
+ pd."receiptPromisedDate",
+ pd."deliveryDate",
+ pd."dropShipment",
+ pp."paymentTermId",
+ pd."locationId",
+ pd."supplierShippingCost",
+ u."fullName" AS "createdByFullName",
+ u."email" AS "createdByEmail"
+ FROM "purchaseOrder" p
+ LEFT JOIN (
+ SELECT
+ pol."purchaseOrderId",
+ MIN(CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END) AS "thumbnailPath",
+ SUM(COALESCE(pol."purchaseQuantity", 0)*(COALESCE(pol."unitPrice", 0)) + COALESCE(pol."shippingCost", 0) + COALESCE(pol."taxAmount", 0)) AS "orderTotal",
+ MIN(i."type") AS "itemType"
+ FROM "purchaseOrderLine" pol
+ LEFT JOIN "item" i
+ ON i."id" = pol."itemId"
+ LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId"
+ GROUP BY pol."purchaseOrderId"
+ ) pl ON pl."purchaseOrderId" = p."id"
+ LEFT JOIN "purchaseOrderDelivery" pd ON pd."id" = p."id"
+ LEFT JOIN "shippingTerm" st ON st."id" = pd."shippingTermId"
+ LEFT JOIN "purchaseOrderPayment" pp ON pp."id" = p."id"
+ LEFT JOIN "user" u ON u."id" = p."createdBy";
+
+
+DROP VIEW IF EXISTS "companies";
+CREATE OR REPLACE VIEW "companies" WITH(SECURITY_INVOKER=true) AS
+ SELECT DISTINCT
+ c.*,
+ cc."name" AS "countryName",
+ uc.*,
+ et.name AS "employeeType"
+ FROM "userToCompany" uc
+ INNER JOIN "company" c
+ ON c.id = uc."companyId"
+ LEFT JOIN "country" cc
+ ON cc.alpha2 = c."countryCode"
+ LEFT JOIN "employee" e
+ ON e.id = uc."userId" AND e."companyId" = uc."companyId"
+ LEFT JOIN "employeeType" et
+ ON et.id = e."employeeTypeId";
+
+
+
+
+
+
+
+
+DROP VIEW IF EXISTS "suppliers";
+CREATE OR REPLACE VIEW "suppliers" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ s.id,
+ s.name,
+ s."supplierTypeId",
+ s."supplierStatusId",
+ s."taxId",
+ s."accountManagerId",
+ s.logo,
+ s.assignee,
+ s."companyId",
+ s."createdAt",
+ s."createdBy",
+ s."updatedAt",
+ s."updatedBy",
+ s."customFields",
+ s."currencyCode",
+ s."vatNumber",
+ s.website,
+ (
+ SELECT COALESCE(
+ jsonb_object_agg(
+ eim."integration",
+ CASE
+ WHEN eim."metadata" IS NOT NULL THEN eim."metadata"
+ ELSE to_jsonb(eim."externalId")
+ END
+ ) FILTER (WHERE eim."externalId" IS NOT NULL OR eim."metadata" IS NOT NULL),
+ '{}'::jsonb
+ )
+ FROM "externalIntegrationMapping" eim
+ WHERE eim."entityType" = 'supplier' AND eim."entityId" = s.id
+ ) AS "externalId",
+ s.tags,
+ s."taxPercent",
+ s."purchasingContactId",
+ s.embedding,
+ s."defaultCc",
+ st.name AS "type",
+ ss.name AS "status",
+ po.count AS "orderCount",
+ p.count AS "partCount",
+ pc."workPhone" AS "phone",
+ pc.fax AS "fax"
+ FROM "supplier" s
+ LEFT JOIN "supplierType" st ON st.id = s."supplierTypeId"
+ LEFT JOIN "supplierStatus" ss ON ss.id = s."supplierStatusId"
+ LEFT JOIN (
+ SELECT
+ "supplierId",
+ COUNT(*) AS "count"
+ FROM "purchaseOrder"
+ GROUP BY "supplierId"
+ ) po ON po."supplierId" = s.id
+ LEFT JOIN (
+ SELECT
+ "supplierId",
+ COUNT(*) AS "count"
+ FROM "supplierPart"
+ GROUP BY "supplierId"
+ ) p ON p."supplierId" = s.id
+ LEFT JOIN (
+ SELECT DISTINCT ON (sc."supplierId")
+ sc."supplierId" AS id,
+ co."workPhone",
+ co."fax"
+ FROM "supplierContact" sc
+ JOIN "contact" co
+ ON co.id = sc."contactId"
+ ORDER BY sc."supplierId", sc.id
+ ) pc
+ ON pc.id = s.id;
+
+
+
+DROP VIEW IF EXISTS "customers";
+CREATE OR REPLACE VIEW "customers" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ c.id,
+ c.name,
+ c."customerTypeId",
+ c."customerStatusId",
+ c."taxId",
+ c."accountManagerId",
+ c.logo,
+ c.assignee,
+ c."taxPercent",
+ c."tags",
+ c.website,
+ c."companyId",
+ c."createdAt",
+ c."createdBy",
+ c."updatedAt",
+ c."updatedBy",
+ c."customFields",
+ c."currencyCode",
+ c."salesContactId",
+ c."defaultCc",
+ c."vatNumber",
+ (
+ SELECT COALESCE(
+ jsonb_object_agg(
+ eim."integration",
+ CASE
+ WHEN eim."metadata" IS NOT NULL THEN eim."metadata"
+ ELSE to_jsonb(eim."externalId")
+ END
+ ) FILTER (WHERE eim."externalId" IS NOT NULL OR eim."metadata" IS NOT NULL),
+ '{}'::jsonb
+ )
+ FROM "externalIntegrationMapping" eim
+ WHERE eim."entityType" = 'customer' AND eim."entityId" = c.id
+ ) AS "externalId",
+ ct.name AS "type",
+ cs.name AS "status",
+ so.count AS "orderCount",
+ pc."workPhone" AS "phone",
+ pc."fax" AS "fax"
+ FROM "customer" c
+ LEFT JOIN "customerType" ct ON ct.id = c."customerTypeId"
+ LEFT JOIN "customerStatus" cs ON cs.id = c."customerStatusId"
+ LEFT JOIN (
+ SELECT
+ "customerId",
+ COUNT(*) AS "count"
+ FROM "salesOrder"
+ GROUP BY "customerId"
+ ) so ON so."customerId" = c.id
+ LEFT JOIN (
+ SELECT DISTINCT ON (cc."customerId")
+ cc."customerId",
+ co."workPhone",
+ co."fax"
+ FROM "customerContact" cc
+ INNER JOIN "contact" co ON co.id = cc."contactId"
+ ORDER BY cc."customerId"
+ ) pc ON pc."customerId" = c.id;
+
+ALTER TABLE "companySettings" ADD COLUMN "accountsPayableAddress" BOOLEAN DEFAULT FALSE;
+ALTER TABLE "companySettings" ADD COLUMN "accountsReceivableAddress" BOOLEAN DEFAULT FALSE;
+
+
+CREATE TABLE "companyAccountsPayableBillingAddress" (
+ "id" TEXT NOT NULL,
+ "name" TEXT DEFAULT 'Accounts Payable',
+ "addressLine1" TEXT,
+ "addressLine2" TEXT,
+ "city" TEXT,
+ "state" TEXT,
+ "postalCode" TEXT,
+ "countryCode" TEXT,
+ "phone" TEXT,
+ "fax" TEXT,
+ "email" TEXT,
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+ "updatedBy" TEXT,
+ CONSTRAINT "companyAccountsPayableBillingAddress_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "companyAccountsPayableBillingAddress_id_fkey" FOREIGN KEY ("id") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+
+CREATE TABLE "companyAccountsReceivableBillingAddress" (
+ "id" TEXT NOT NULL,
+ "name" TEXT DEFAULT 'Accounts Receivable',
+ "addressLine1" TEXT,
+ "addressLine2" TEXT,
+ "city" TEXT,
+ "state" TEXT,
+ "postalCode" TEXT,
+ "countryCode" TEXT,
+ "phone" TEXT,
+ "fax" TEXT,
+ "email" TEXT,
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+ "updatedBy" TEXT,
+ CONSTRAINT "companyAccountsReceivableBillingAddress_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "companyAccountsReceivableBillingAddress_id_fkey" FOREIGN KEY ("id") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+
+-- RLS for companyAccountsPayableBillingAddress
+ALTER TABLE "companyAccountsPayableBillingAddress" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."companyAccountsPayableBillingAddress"
+FOR SELECT USING (
+ "id" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."companyAccountsPayableBillingAddress"
+FOR INSERT WITH CHECK (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_create'))::text[])
+);
+
+CREATE POLICY "UPDATE" ON "public"."companyAccountsPayableBillingAddress"
+FOR UPDATE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_update'))::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."companyAccountsPayableBillingAddress"
+FOR DELETE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_delete'))::text[])
+);
+
+
+-- RLS for companyAccountsReceivableBillingAddress
+ALTER TABLE "companyAccountsReceivableBillingAddress" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."companyAccountsReceivableBillingAddress"
+FOR SELECT USING (
+ "id" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."companyAccountsReceivableBillingAddress"
+FOR INSERT WITH CHECK (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_create'))::text[])
+);
+
+CREATE POLICY "UPDATE" ON "public"."companyAccountsReceivableBillingAddress"
+FOR UPDATE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_update'))::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."companyAccountsReceivableBillingAddress"
+FOR DELETE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_delete'))::text[])
+);
+
+
+-- Update insert_company_related_records to auto-create billing address records
+CREATE OR REPLACE FUNCTION insert_company_related_records()
+RETURNS TRIGGER AS $$
+BEGIN
+ INSERT INTO "terms" ("id") VALUES (NEW.id);
+
+ INSERT INTO "companySettings" ("id", "useMetric")
+ VALUES (
+ NEW.id,
+ CASE
+ WHEN NEW."countryCode" = 'US' OR NEW."baseCurrencyCode" = 'USD' THEN false
+ ELSE true
+ END
+ );
+
+ INSERT INTO "companyAccountsPayableBillingAddress" ("id", "addressLine1", "addressLine2", "city", "state", "postalCode", "countryCode", "phone", "fax", "email")
+ VALUES (NEW.id, NEW."addressLine1", NEW."addressLine2", NEW."city", NEW."stateProvince", NEW."postalCode", NEW."countryCode", NEW."phone", NEW."fax", NEW."email");
+
+ INSERT INTO "companyAccountsReceivableBillingAddress" ("id", "addressLine1", "addressLine2", "city", "state", "postalCode", "countryCode", "phone", "fax", "email")
+ VALUES (NEW.id, NEW."addressLine1", NEW."addressLine2", NEW."city", NEW."stateProvince", NEW."postalCode", NEW."countryCode", NEW."phone", NEW."fax", NEW."email");
+
+ RETURN NEW;
+END;
+$$ LANGUAGE plpgsql;
+
+
+-- Backfill existing companies
+INSERT INTO "companyAccountsPayableBillingAddress" ("id", "addressLine1", "addressLine2", "city", "state", "postalCode", "countryCode", "phone", "fax", "email")
+SELECT
+ c."id",
+ c."addressLine1",
+ c."addressLine2",
+ c."city",
+ c."stateProvince",
+ c."postalCode",
+ c."countryCode",
+ c."phone",
+ c."fax",
+ c."email"
+FROM "company" c
+ON CONFLICT ("id") DO NOTHING;
+
+INSERT INTO "companyAccountsReceivableBillingAddress" ("id", "addressLine1", "addressLine2", "city", "state", "postalCode", "countryCode", "phone", "fax", "email")
+SELECT
+ c."id",
+ c."addressLine1",
+ c."addressLine2",
+ c."city",
+ c."stateProvince",
+ c."postalCode",
+ c."countryCode",
+ c."phone",
+ c."fax",
+ c."email"
+FROM "company" c
+ON CONFLICT ("id") DO NOTHING;
+
+DROP VIEW "purchaseOrderLines";
+ALTER TABLE "purchaseOrderLine" ADD COLUMN "requestedDate" DATE;
+ALTER TABLE "purchaseOrderLine" ADD COLUMN "receivedDate" DATE;
+
+DROP VIEW IF EXISTS "purchaseOrderLines";
+CREATE OR REPLACE VIEW "purchaseOrderLines" WITH(SECURITY_INVOKER=true) AS (
+ SELECT DISTINCT ON (pl.id)
+ pl.*,
+ CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ WHEN i."thumbnailPath" IS NULL AND imu."thumbnailPath" IS NOT NULL THEN imu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END as "thumbnailPath",
+ i.name as "itemName",
+ i."readableIdWithRevision" as "itemReadableId",
+ i.description as "itemDescription",
+ COALESCE(mu.id, imu.id) as "modelId",
+ COALESCE(mu."autodeskUrn", imu."autodeskUrn") as "autodeskUrn",
+ COALESCE(mu."modelPath", imu."modelPath") as "modelPath",
+ COALESCE(mu."name", imu."name") as "modelName",
+ COALESCE(mu."size", imu."size") as "modelSize",
+ ic."unitCost" as "unitCost",
+ sp."supplierPartId",
+ jo."description" as "jobOperationDescription"
+ FROM "purchaseOrderLine" pl
+ INNER JOIN "purchaseOrder" so ON so.id = pl."purchaseOrderId"
+ LEFT JOIN "modelUpload" mu ON pl."modelUploadId" = mu."id"
+ INNER JOIN "item" i ON i.id = pl."itemId"
+ LEFT JOIN "itemCost" ic ON ic."itemId" = i.id
+ LEFT JOIN "modelUpload" imu ON imu.id = i."modelUploadId"
+ LEFT JOIN "supplierPart" sp ON sp."supplierId" = so."supplierId" AND sp."itemId" = i.id
+ LEFT JOIN "jobOperation" jo ON jo."id" = pl."jobOperationId"
+);
\ No newline at end of file
diff --git a/packages/database/supabase/migrations/20260306000000_sales-invoice-shipment-location.sql b/packages/database/supabase/migrations/20260306000000_sales-invoice-shipment-location.sql
new file mode 100644
index 0000000000..5201475b5c
--- /dev/null
+++ b/packages/database/supabase/migrations/20260306000000_sales-invoice-shipment-location.sql
@@ -0,0 +1,54 @@
+CREATE OR REPLACE VIEW "salesInvoiceLocations" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ si.id,
+ c.name AS "customerName",
+ ca."addressLine1" AS "customerAddressLine1",
+ ca."addressLine2" AS "customerAddressLine2",
+ ca."city" AS "customerCity",
+ ca."stateProvince" AS "customerStateProvince",
+ ca."postalCode" AS "customerPostalCode",
+ ca."countryCode" AS "customerCountryCode",
+ cc."name" AS "customerCountryName",
+ ic.name AS "invoiceCustomerName",
+ ica."addressLine1" AS "invoiceAddressLine1",
+ ica."addressLine2" AS "invoiceAddressLine2",
+ ica."city" AS "invoiceCity",
+ ica."stateProvince" AS "invoiceStateProvince",
+ ica."postalCode" AS "invoicePostalCode",
+ ica."countryCode" AS "invoiceCountryCode",
+ icc."name" AS "invoiceCountryName",
+ sc.name AS "shipmentCustomerName",
+ sa."addressLine1" AS "shipmentAddressLine1",
+ sa."addressLine2" AS "shipmentAddressLine2",
+ sa."city" AS "shipmentCity",
+ sa."stateProvince" AS "shipmentStateProvince",
+ sa."postalCode" AS "shipmentPostalCode",
+ sa."countryCode" AS "shipmentCountryCode",
+ scc."name" AS "shipmentCountryName"
+ FROM "salesInvoice" si
+ INNER JOIN "customer" c
+ ON c.id = si."customerId"
+ LEFT OUTER JOIN "customerLocation" cl
+ ON cl.id = si."locationId"
+ LEFT OUTER JOIN "address" ca
+ ON ca.id = cl."addressId"
+ LEFT OUTER JOIN "country" cc
+ ON cc.alpha2 = ca."countryCode"
+ LEFT OUTER JOIN "customer" ic
+ ON ic.id = si."invoiceCustomerId"
+ LEFT OUTER JOIN "customerLocation" icl
+ ON icl.id = si."invoiceCustomerLocationId"
+ LEFT OUTER JOIN "address" ica
+ ON ica.id = icl."addressId"
+ LEFT OUTER JOIN "country" icc
+ ON icc.alpha2 = ica."countryCode"
+ LEFT OUTER JOIN "salesInvoiceShipment" sis
+ ON sis.id = si.id
+ LEFT OUTER JOIN "customerLocation" scl
+ ON scl.id = sis."locationId"
+ LEFT OUTER JOIN "address" sa
+ ON sa.id = scl."addressId"
+ LEFT OUTER JOIN "country" scc
+ ON scc.alpha2 = sa."countryCode"
+ LEFT OUTER JOIN "customer" sc
+ ON sc.id = scl."customerId";
diff --git a/packages/documents/src/pdf/IssuePDF.tsx b/packages/documents/src/pdf/IssuePDF.tsx
index a7329583f7..c118677b3c 100644
--- a/packages/documents/src/pdf/IssuePDF.tsx
+++ b/packages/documents/src/pdf/IssuePDF.tsx
@@ -124,6 +124,7 @@ const IssuePDF = ({
company={company}
title="Issue Report"
documentId={nonConformance.nonConformanceId}
+ date={nonConformance.openDate}
/>
{/* Issue Details */}
diff --git a/packages/documents/src/pdf/JobTravelerPDF.tsx b/packages/documents/src/pdf/JobTravelerPDF.tsx
index 52940536bd..1d5be30a60 100644
--- a/packages/documents/src/pdf/JobTravelerPDF.tsx
+++ b/packages/documents/src/pdf/JobTravelerPDF.tsx
@@ -261,7 +261,12 @@ export const JobTravelerPageContent = ({
<View style={tw("flex flex-col")}>
{/* Original Header Section with company logo and job title */}
<View style={tw("mb-6")}>
- <Header company={company} title="Job Traveler" documentId={job.jobId} />
+ <Header
+ company={company}
+ title="Job Traveler"
+ documentId={job.jobId}
+ date={job.startDate}
+ />
</View>
{/* Job Header Section with detailed information */}
diff --git a/packages/documents/src/pdf/PackingSlipPDF.tsx b/packages/documents/src/pdf/PackingSlipPDF.tsx
index 51b830f2ae..29e3190813 100644
--- a/packages/documents/src/pdf/PackingSlipPDF.tsx
+++ b/packages/documents/src/pdf/PackingSlipPDF.tsx
@@ -102,6 +102,7 @@ const PackingSlipPDF = ({
company={company}
title="Packing Slip"
documentId={shipment?.shipmentId}
+ date={shipment?.postingDate}
/>
{/* Ship To */}
diff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
index 366f1c3d0f..c1a048fc0d 100644
--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx
+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
@@ -1,9 +1,9 @@
import type { Database } from "@carbon/database";
import type { JSONContent } from "@carbon/react";
-import { formatCityStatePostalCode } from "@carbon/utils";
+import { formatDate } from "@carbon/utils";
import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
-import type { PDF } from "../types";
+import type { AccountsPayableBillingAddress, PDF } from "../types";
import {
getLineDescription,
getLineDescriptionDetails,
@@ -11,12 +11,23 @@ import {
getTotal
} from "../utils/purchase-order";
import { getCurrencyFormatter } from "../utils/shared";
-import { Header, Note, Template } from "./components";
+import {
+ Header,
+ Note,
+ PartyDetails,
+ ShipBillDetails,
+ Template
+} from "./components";
interface PurchaseOrderPDFProps extends PDF {
purchaseOrder: Database["public"]["Views"]["purchaseOrders"]["Row"];
purchaseOrderLines: Database["public"]["Views"]["purchaseOrderLines"]["Row"][];
purchaseOrderLocations: Database["public"]["Views"]["purchaseOrderLocations"]["Row"];
+ companySettings?:
+ | Database["public"]["Tables"]["companySettings"]["Row"]
+ | null;
+ accountsPayableBillingAddress?: AccountsPayableBillingAddress | null;
+ paymentTerms?: { id: string; name: string }[];
terms: JSONContent;
thumbnails?: Record<string, string | null>;
}
@@ -40,24 +51,13 @@ const tw = createTw({
}
});
-const formatDate = (dateStr: string | null) => {
- if (!dateStr) return null;
- try {
- const date = new Date(dateStr);
- return date.toLocaleDateString("en-US", {
- year: "numeric",
- month: "long",
- day: "numeric"
- });
- } catch {
- return dateStr;
- }
-};
-
const PurchaseOrderPDF = ({
+ accountsPayableBillingAddress,
company,
+ companySettings,
locale,
meta,
+ paymentTerms,
purchaseOrder,
purchaseOrderLines,
purchaseOrderLocations,
@@ -72,14 +72,14 @@ const PurchaseOrderPDF = ({
supplierCity,
supplierStateProvince,
supplierPostalCode,
- supplierCountryName,
+ supplierCountryCode,
deliveryName,
deliveryAddressLine1,
deliveryAddressLine2,
deliveryCity,
deliveryStateProvince,
deliveryPostalCode,
- deliveryCountryName,
+ deliveryCountryCode,
dropShipment,
customerName,
customerAddressLine1,
@@ -87,7 +87,7 @@ const PurchaseOrderPDF = ({
customerCity,
customerStateProvince,
customerPostalCode,
- customerCountryName
+ customerCountryCode
} = purchaseOrderLocations;
const formatter = getCurrencyFormatter(
@@ -100,6 +100,9 @@ const PurchaseOrderPDF = ({
);
const shippingCost = purchaseOrder?.supplierShippingCost ?? 0;
+ const paymentTerm = paymentTerms?.find(
+ (term) => term.id === purchaseOrder?.paymentTermId
+ );
let rowIndex = 0;
@@ -116,91 +119,78 @@ const PurchaseOrderPDF = ({
company={company}
title="Purchase Order"
documentId={purchaseOrder?.purchaseOrderId}
+ date={purchaseOrder?.orderDate}
+ currencyCode={purchaseOrder?.currencyCode}
/>
- {/* Supplier & Ship To Details */}
- <View style={tw("border border-gray-200 mb-4")}>
- <View style={tw("flex flex-row")}>
- <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Supplier
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {supplierName && (
- <Text style={tw("font-bold")}>{supplierName}</Text>
- )}
- {supplierAddressLine1 && <Text>{supplierAddressLine1}</Text>}
- {supplierAddressLine2 && <Text>{supplierAddressLine2}</Text>}
- {(supplierCity ||
- supplierStateProvince ||
- supplierPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- supplierCity,
- supplierStateProvince,
- supplierPostalCode
- )}
- </Text>
- )}
- {supplierCountryName && <Text>{supplierCountryName}</Text>}
- </View>
- </View>
- <View style={tw("w-1/2 p-3")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Ship To
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {dropShipment ? (
- <>
- {customerName && (
- <Text style={tw("font-bold")}>{customerName}</Text>
- )}
- {customerAddressLine1 && <Text>{customerAddressLine1}</Text>}
- {customerAddressLine2 && <Text>{customerAddressLine2}</Text>}
- {(customerCity ||
- customerStateProvince ||
- customerPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- customerCity,
- customerStateProvince,
- customerPostalCode
- )}
- </Text>
- )}
- {customerCountryName && <Text>{customerCountryName}</Text>}
- </>
- ) : (
- <>
- {deliveryName && (
- <Text style={tw("font-bold")}>{deliveryName}</Text>
- )}
- {deliveryAddressLine1 && <Text>{deliveryAddressLine1}</Text>}
- {deliveryAddressLine2 && <Text>{deliveryAddressLine2}</Text>}
- {(deliveryCity ||
- deliveryStateProvince ||
- deliveryPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- deliveryCity,
- deliveryStateProvince,
- deliveryPostalCode
- )}
- </Text>
- )}
- {deliveryCountryName && <Text>{deliveryCountryName}</Text>}
- </>
- )}
- </View>
- </View>
- </View>
- </View>
+ <PartyDetails
+ company={company}
+ companyLabel="Buyer"
+ counterParty={{
+ name: supplierName,
+ addressLine1: supplierAddressLine1,
+ addressLine2: supplierAddressLine2,
+ city: supplierCity,
+ stateProvince: supplierStateProvince,
+ postalCode: supplierPostalCode,
+ countryCode: supplierCountryCode,
+ taxId: purchaseOrderLocations.supplierTaxId,
+ vatNumber: purchaseOrderLocations.supplierVatNumber,
+ contactName: purchaseOrderLocations.supplierContactName,
+ contactEmail: purchaseOrderLocations.supplierContactEmail
+ }}
+ counterPartyLabel="Supplier"
+ createdByFullName={purchaseOrder.createdByFullName}
+ createdByEmail={purchaseOrder.createdByEmail}
+ accountsPayableEmail={companySettings?.accountsPayableEmail}
+ />
+
+ <ShipBillDetails
+ shipTo={
+ dropShipment
+ ? {
+ name: customerName,
+ addressLine1: customerAddressLine1,
+ addressLine2: customerAddressLine2,
+ city: customerCity,
+ stateProvince: customerStateProvince,
+ postalCode: customerPostalCode,
+ countryCode: customerCountryCode
+ }
+ : {
+ name: deliveryName,
+ addressLine1: deliveryAddressLine1,
+ addressLine2: deliveryAddressLine2,
+ city: deliveryCity,
+ stateProvince: deliveryStateProvince,
+ postalCode: deliveryPostalCode,
+ countryCode: deliveryCountryCode
+ }
+ }
+ billTo={
+ accountsPayableBillingAddress
+ ? {
+ name: accountsPayableBillingAddress.name,
+ addressLine1: accountsPayableBillingAddress.addressLine1,
+ addressLine2: accountsPayableBillingAddress.addressLine2,
+ city: accountsPayableBillingAddress.city,
+ stateProvince: accountsPayableBillingAddress.state,
+ postalCode: accountsPayableBillingAddress.postalCode,
+ countryCode: accountsPayableBillingAddress.countryCode
+ }
+ : {
+ name: company.name,
+ addressLine1: company.addressLine1,
+ addressLine2: company.addressLine2,
+ city: company.city,
+ stateProvince: company.stateProvince,
+ postalCode: company.postalCode,
+ countryCode: company.countryCode
+ }
+ }
+ />
- {/* Order Details */}
+ {/* Order Details & Notes */}
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("flex flex-row")}>
<View style={tw("w-1/2 p-3 border-r border-gray-200")}>
@@ -214,19 +204,33 @@ const PurchaseOrderPDF = ({
{purchaseOrder?.supplierReference && (
<Text>Reference: {purchaseOrder.supplierReference}</Text>
)}
+ {purchaseOrder?.receiptRequestedDate && (
+ <Text>
+ Requested Date:{" "}
+ {formatDate(purchaseOrder.receiptRequestedDate)}
+ </Text>
+ )}
+ {purchaseOrder?.receiptPromisedDate && (
+ <Text>
+ Promised Date: {formatDate(purchaseOrder.receiptPromisedDate)}
+ </Text>
+ )}
+ {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Delivery
+ Notes
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {purchaseOrder?.receiptPromisedDate && (
- <Text>
- Promised Date: {formatDate(purchaseOrder.receiptPromisedDate)}
- </Text>
+ {Object.keys(purchaseOrder?.externalNotes ?? {}).length > 0 ? (
+ <Note
+ content={(purchaseOrder.externalNotes ?? {}) as JSONContent}
+ />
+ ) : (
+ <Text style={tw("text-gray-400")}>None</Text>
)}
</View>
</View>
@@ -241,10 +245,13 @@ const PurchaseOrderPDF = ({
"flex flex-row bg-gray-800 py-2 px-3 text-white text-[9px] font-bold"
)}
>
- <Text style={tw("w-1/2")}>Description</Text>
- <Text style={tw("w-1/6 text-right")}>Qty</Text>
- <Text style={tw("w-1/6 text-right")}>Unit Price</Text>
- <Text style={tw("w-1/6 text-right")}>Total</Text>
+ <Text style={tw("w-[5%] text-center")}>#</Text>
+ <Text style={tw("w-[33%]")}>Description</Text>
+ <Text style={tw("w-[12%] text-right")}>Qty</Text>
+ <Text style={tw("w-[10%] text-center")}>UOM</Text>
+ <Text style={tw("w-[15%] text-right")}>Unit Price</Text>
+ <Text style={tw("w-[12%] text-right")}>Tax</Text>
+ <Text style={tw("w-[13%] text-right")}>Total</Text>
</View>
{/* Rows */}
@@ -262,13 +269,22 @@ const PurchaseOrderPDF = ({
)}
>
<View style={tw("flex flex-row")}>
- <View style={tw("w-1/2 pr-2")}>
+ <Text style={tw("w-[5%] text-center text-gray-400")}>
+ {line.purchaseOrderLineType === "Comment" ? "" : rowIndex}
+ </Text>
+ <View style={tw("w-[33%] pr-2")}>
<Text style={tw("text-gray-800")}>
{getLineDescription(line)}
</Text>
<Text style={tw("text-[8px] text-gray-400 mt-0.5")}>
{getLineDescriptionDetails(line)}
</Text>
+ {line.requestedDate &&
+ line.purchaseOrderLineType !== "Comment" && (
+ <Text style={tw("text-[8px] text-gray-400 mt-0.5")}>
+ Required: {formatDate(line.requestedDate)}
+ </Text>
+ )}
{purchaseOrder.purchaseOrderType === "Outside Processing" &&
line.jobOperationDescription && (
<Text style={tw("text-[8px] text-gray-400 mt-0.5")}>
@@ -276,6 +292,7 @@ const PurchaseOrderPDF = ({
</Text>
)}
{thumbnails &&
+ line.id &&
line.id in thumbnails &&
thumbnails[line.id] && (
<View style={tw("mt-1 w-16")}>
@@ -286,18 +303,37 @@ const PurchaseOrderPDF = ({
</View>
)}
</View>
- <Text style={tw("w-1/6 text-right text-gray-600")}>
+ <Text style={tw("w-[12%] text-right text-gray-600")}>
+ {line.purchaseOrderLineType === "Comment"
+ ? ""
+ : line.purchaseQuantity}
+ </Text>
+ <Text style={tw("w-[10%] text-center text-gray-600")}>
{line.purchaseOrderLineType === "Comment"
? ""
- : `${line.purchaseQuantity} ${line.purchaseUnitOfMeasureCode}`}
+ : line.purchaseUnitOfMeasureCode}
</Text>
- <Text style={tw("w-1/6 text-right text-gray-600")}>
+ <Text style={tw("w-[15%] text-right text-gray-600")}>
{line.purchaseOrderLineType === "Comment"
? ""
: formatter.format(line.supplierUnitPrice ?? 0)}
</Text>
+ <View style={tw("w-[12%]")}>
+ {line.purchaseOrderLineType !== "Comment" && (
+ <View style={tw("flex flex-col items-end")}>
+ <Text style={tw("text-gray-600")}>
+ {formatter.format(line.supplierTaxAmount ?? 0)}
+ </Text>
+ {(line.taxPercent ?? 0) > 0 && (
+ <Text style={tw("text-[7px] text-gray-400")}>
+ {((line.taxPercent ?? 0) * 100).toFixed(0)}%
+ </Text>
+ )}
+ </View>
+ )}
+ </View>
<Text
- style={tw("w-1/6 text-right text-gray-800 font-medium")}
+ style={tw("w-[13%] text-right text-gray-800 font-medium")}
>
{line.purchaseOrderLineType === "Comment"
? ""
@@ -321,9 +357,9 @@ const PurchaseOrderPDF = ({
<View>
{/* Subtotal - before tax and shipping */}
<View style={tw("flex flex-row py-1.5 px-3 bg-gray-50 text-[10px]")}>
- <View style={tw("w-4/6")} />
- <Text style={tw("w-1/6 text-right text-gray-600")}>Subtotal</Text>
- <Text style={tw("w-1/6 text-right text-gray-800")}>
+ <View style={tw("w-[75%]")} />
+ <Text style={tw("w-[12%] text-right text-gray-600")}>Subtotal</Text>
+ <Text style={tw("w-[13%] text-right text-gray-800")}>
{formatter.format(
purchaseOrderLines.reduce((sum, line) => {
if (line?.purchaseQuantity && line?.supplierUnitPrice) {
@@ -340,9 +376,11 @@ const PurchaseOrderPDF = ({
<View
style={tw("flex flex-row py-1.5 px-3 bg-gray-50 text-[10px]")}
>
- <View style={tw("w-4/6")} />
- <Text style={tw("w-1/6 text-right text-gray-600")}>Shipping</Text>
- <Text style={tw("w-1/6 text-right text-gray-800")}>
+ <View style={tw("w-[75%]")} />
+ <Text style={tw("w-[12%] text-right text-gray-600")}>
+ Shipping
+ </Text>
+ <Text style={tw("w-[13%] text-right text-gray-800")}>
{formatter.format(shippingCost)}
</Text>
</View>
@@ -353,9 +391,9 @@ const PurchaseOrderPDF = ({
<View
style={tw("flex flex-row py-1.5 px-3 bg-gray-50 text-[10px]")}
>
- <View style={tw("w-4/6")} />
- <Text style={tw("w-1/6 text-right text-gray-600")}>Tax</Text>
- <Text style={tw("w-1/6 text-right text-gray-800")}>
+ <View style={tw("w-[75%]")} />
+ <Text style={tw("w-[12%] text-right text-gray-600")}>Tax</Text>
+ <Text style={tw("w-[13%] text-right text-gray-800")}>
{formatter.format(taxAmount)}
</Text>
</View>
@@ -363,27 +401,19 @@ const PurchaseOrderPDF = ({
<View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[11px]")}>
- <View style={tw("w-4/6")} />
- <Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
+ <View style={tw("w-[75%]")} />
+ <Text style={tw("w-[12%] text-right text-gray-800 font-bold")}>
Total
</Text>
- <Text style={tw("w-1/6 text-right text-gray-800 font-bold")}>
+ <Text style={tw("w-[13%] text-right text-gray-800 font-bold")}>
{formatter.format(getTotal(purchaseOrderLines) + shippingCost)}
</Text>
</View>
</View>
</View>
- {/* Notes & Terms */}
- <View style={tw("flex flex-col gap-3 w-full")}>
- {Object.keys(purchaseOrder?.externalNotes ?? {}).length > 0 && (
- <Note
- title="Notes"
- content={(purchaseOrder.externalNotes ?? {}) as JSONContent}
- />
- )}
- <Note title="Standard Terms & Conditions" content={terms} />
- </View>
+ {/* Terms */}
+ <Note title="Standard Terms & Conditions" content={terms} />
</Template>
);
};
diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsx
index 6d06a797d2..861728992e 100644
--- a/packages/documents/src/pdf/QuotePDF.tsx
+++ b/packages/documents/src/pdf/QuotePDF.tsx
@@ -1,13 +1,13 @@
import type { Database } from "@carbon/database";
import type { JSONContent } from "@carbon/react";
-import { formatCityStatePostalCode, pluralize } from "@carbon/utils";
+import { pluralize } from "@carbon/utils";
import { getLocalTimeZone, today } from "@internationalized/date";
import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
-import type { PDF } from "../types";
+import type { AccountsReceivableBillingAddress, PDF } from "../types";
import { getLineDescription, getLineDescriptionDetails } from "../utils/quote";
import { getCurrencyFormatter } from "../utils/shared";
-import { Header, Note, Template } from "./components";
+import { Header, Note, PartyDetails, Template } from "./components";
interface QuotePDFProps extends PDF {
exchangeRate: number;
@@ -17,6 +17,10 @@ interface QuotePDFProps extends PDF {
quoteLinePrices: Database["public"]["Tables"]["quoteLinePrice"]["Row"][];
payment?: Database["public"]["Tables"]["quotePayment"]["Row"] | null;
shipment?: Database["public"]["Tables"]["quoteShipment"]["Row"] | null;
+ accountsReceivableBillingAddress?: AccountsReceivableBillingAddress | null;
+ companySettings?:
+ | Database["public"]["Tables"]["companySettings"]["Row"]
+ | null;
paymentTerms: { id: string; name: string }[];
shippingMethods: { id: string; name: string }[];
terms: JSONContent;
@@ -43,7 +47,9 @@ const tw = createTw({
});
const QuotePDF = ({
+ accountsReceivableBillingAddress,
company,
+ companySettings,
locale,
meta,
exchangeRate,
@@ -65,7 +71,7 @@ const QuotePDF = ({
customerCity,
customerStateProvince,
customerPostalCode,
- customerCountryName,
+ customerCountryCode,
contactName,
contactEmail
} = quoteCustomerDetails;
@@ -207,55 +213,82 @@ const QuotePDF = ({
subject: meta?.subject ?? "Quote"
}}
>
- <Header company={company} title="Quote" documentId={quote?.quoteId} />
+ <Header
+ company={company}
+ title="Quote"
+ documentId={quote?.quoteId}
+ currencyCode={quote?.currencyCode}
+ />
- {/* Customer & Quote Details */}
+ <PartyDetails
+ company={company}
+ companyAddressOverride={
+ accountsReceivableBillingAddress
+ ? {
+ name: accountsReceivableBillingAddress.name,
+ addressLine1: accountsReceivableBillingAddress.addressLine1,
+ addressLine2: accountsReceivableBillingAddress.addressLine2,
+ city: accountsReceivableBillingAddress.city,
+ stateProvince: accountsReceivableBillingAddress.state,
+ postalCode: accountsReceivableBillingAddress.postalCode,
+ countryCode: accountsReceivableBillingAddress.countryCode
+ }
+ : undefined
+ }
+ companyLabel="Seller"
+ counterParty={{
+ name: customerName,
+ addressLine1: customerAddressLine1,
+ addressLine2: customerAddressLine2,
+ city: customerCity,
+ stateProvince: customerStateProvince,
+ postalCode: customerPostalCode,
+ countryCode: customerCountryCode,
+ contactName: contactName,
+ contactEmail: contactEmail
+ }}
+ counterPartyLabel="Buyer"
+ accountsReceivableEmail={companySettings?.accountsReceivableEmail}
+ />
+
+ {/* Quote Details & Notes */}
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("flex flex-row")}>
<View style={tw("w-1/2 p-3 border-r border-gray-200")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Customer
+ Quote Details
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {customerName && (
- <Text style={tw("font-bold")}>{customerName}</Text>
+ <Text>
+ Date: {formatDate(today(getLocalTimeZone()).toString())}
+ </Text>
+ {quote.expirationDate && (
+ <Text>Expires: {formatDate(quote.expirationDate)}</Text>
)}
- {contactName && <Text>{contactName}</Text>}
- {contactEmail && <Text>{contactEmail}</Text>}
- {customerAddressLine1 && (
- <Text style={tw("mt-1")}>{customerAddressLine1}</Text>
+ {quote.customerReference && (
+ <Text>Reference: {quote.customerReference}</Text>
)}
- {customerAddressLine2 && <Text>{customerAddressLine2}</Text>}
- {(customerCity || customerStateProvince) && (
+ {maxLeadTime > 0 && (
<Text>
- {formatCityStatePostalCode(
- customerCity,
- customerStateProvince,
- null
- )}
+ Max Lead Time: {maxLeadTime} {pluralize(maxLeadTime, "day")}
</Text>
)}
- {customerPostalCode && <Text>{customerPostalCode}</Text>}
- {customerCountryName && <Text>{customerCountryName}</Text>}
+ {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Quote Details
+ Notes
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- <Text>
- Date: {formatDate(today(getLocalTimeZone()).toString())}
- </Text>
- {quote.expirationDate && (
- <Text>Expires: {formatDate(quote.expirationDate)}</Text>
- )}
- {quote.customerReference && (
- <Text>Reference: {quote.customerReference}</Text>
+ {Object.keys(quote?.externalNotes ?? {}).length > 0 ? (
+ <Note content={(quote.externalNotes ?? {}) as JSONContent} />
+ ) : (
+ <Text style={tw("text-gray-400")}>None</Text>
)}
</View>
</View>
@@ -552,36 +585,7 @@ const QuotePDF = ({
)}
</View>
- {/* Footer - Lead Time & Payment Terms */}
- {(maxLeadTime > 0 || paymentTerm) && (
- <View style={tw("flex flex-row gap-8 mb-4 text-[10px]")}>
- {maxLeadTime > 0 && (
- <View style={tw("flex flex-row")}>
- <Text style={tw("font-bold text-gray-800")}>Max Lead Time: </Text>
- <Text style={tw("text-gray-600")}>
- {maxLeadTime} {pluralize(maxLeadTime, "day")}
- </Text>
- </View>
- )}
- {paymentTerm && (
- <View style={tw("flex flex-row")}>
- <Text style={tw("font-bold text-gray-800")}>Payment Terms: </Text>
- <Text style={tw("text-gray-600")}>{paymentTerm.name}</Text>
- </View>
- )}
- </View>
- )}
-
- {/* Notes & Terms */}
- <View style={tw("flex flex-col gap-3 w-full")}>
- {Object.keys(quote.externalNotes ?? {}).length > 0 && (
- <Note
- title="Notes"
- content={(quote.externalNotes ?? {}) as JSONContent}
- />
- )}
- <Note title="Standard Terms & Conditions" content={terms} />
- </View>
+ <Note title="Standard Terms & Conditions" content={terms} />
</Template>
);
};
diff --git a/packages/documents/src/pdf/SalesInvoicePDF.tsx b/packages/documents/src/pdf/SalesInvoicePDF.tsx
index f9b0066451..9689135d59 100644
--- a/packages/documents/src/pdf/SalesInvoicePDF.tsx
+++ b/packages/documents/src/pdf/SalesInvoicePDF.tsx
@@ -1,9 +1,9 @@
import type { Database } from "@carbon/database";
import type { JSONContent } from "@carbon/react";
-import { formatCityStatePostalCode } from "@carbon/utils";
+import { formatDate } from "@carbon/utils";
import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
-import type { PDF } from "../types";
+import type { AccountsReceivableBillingAddress, PDF } from "../types";
import {
getLineDescription,
getLineDescriptionDetails,
@@ -12,13 +12,23 @@ import {
getTotal
} from "../utils/sales-invoice";
import { getCurrencyFormatter } from "../utils/shared";
-import { Header, Note, Template } from "./components";
+import {
+ Header,
+ Note,
+ PartyDetails,
+ ShipBillDetails,
+ Template
+} from "./components";
interface SalesInvoicePDFProps extends PDF {
salesInvoice: Database["public"]["Views"]["salesInvoices"]["Row"];
salesInvoiceLines: Database["public"]["Views"]["salesInvoiceLines"]["Row"][];
salesInvoiceLocations: Database["public"]["Views"]["salesInvoiceLocations"]["Row"];
salesInvoiceShipment: Database["public"]["Tables"]["salesInvoiceShipment"]["Row"];
+ accountsReceivableBillingAddress?: AccountsReceivableBillingAddress | null;
+ companySettings?:
+ | Database["public"]["Tables"]["companySettings"]["Row"]
+ | null;
paymentTerms: { id: string; name: string }[];
shippingMethods: { id: string; name: string }[];
terms: JSONContent;
@@ -45,7 +55,9 @@ const tw = createTw({
});
const SalesInvoicePDF = ({
+ accountsReceivableBillingAddress,
company,
+ companySettings,
locale,
meta,
salesInvoice,
@@ -72,7 +84,14 @@ const SalesInvoicePDF = ({
invoiceCity,
invoiceStateProvince,
invoicePostalCode,
- invoiceCountryName
+ invoiceCountryName,
+ shipmentCustomerName,
+ shipmentAddressLine1,
+ shipmentAddressLine2,
+ shipmentCity,
+ shipmentStateProvince,
+ shipmentPostalCode,
+ shipmentCountryName
} = salesInvoiceLocations;
const currencyCode = salesInvoice.currencyCode ?? company.baseCurrencyCode;
@@ -86,20 +105,6 @@ const SalesInvoicePDF = ({
(method) => method.id === salesInvoiceShipment?.shippingMethodId
);
- const formatDate = (dateStr: string | null) => {
- if (!dateStr) return null;
- try {
- const date = new Date(dateStr);
- return date.toLocaleDateString("en-US", {
- year: "numeric",
- month: "long",
- day: "numeric"
- });
- } catch {
- return dateStr;
- }
- };
-
let rowIndex = 0;
return (
@@ -115,69 +120,61 @@ const SalesInvoicePDF = ({
company={company}
title="Invoice"
documentId={salesInvoice?.invoiceId}
+ date={salesInvoice?.dateIssued}
+ currencyCode={salesInvoice?.currencyCode}
/>
- {/* Ship To & Bill To */}
- <View style={tw("border border-gray-200 mb-4")}>
- <View style={tw("flex flex-row")}>
- <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Ship To
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {customerName && (
- <Text style={tw("font-bold")}>{customerName}</Text>
- )}
- {customerAddressLine1 && (
- <Text style={tw("mt-1")}>{customerAddressLine1}</Text>
- )}
- {customerAddressLine2 && <Text>{customerAddressLine2}</Text>}
- {(customerCity ||
- customerStateProvince ||
- customerPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- customerCity,
- customerStateProvince,
- customerPostalCode
- )}
- </Text>
- )}
- {customerCountryName && <Text>{customerCountryName}</Text>}
- </View>
- </View>
- <View style={tw("w-1/2 p-3")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Bill To
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {invoiceCustomerName && (
- <Text style={tw("font-bold")}>{invoiceCustomerName}</Text>
- )}
- {invoiceAddressLine1 && (
- <Text style={tw("mt-1")}>{invoiceAddressLine1}</Text>
- )}
- {invoiceAddressLine2 && <Text>{invoiceAddressLine2}</Text>}
- {(invoiceCity || invoiceStateProvince || invoicePostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- invoiceCity,
- invoiceStateProvince,
- invoicePostalCode
- )}
- </Text>
- )}
- {invoiceCountryName && <Text>{invoiceCountryName}</Text>}
- </View>
- </View>
- </View>
- </View>
+ <PartyDetails
+ company={company}
+ companyAddressOverride={
+ accountsReceivableBillingAddress
+ ? {
+ name: accountsReceivableBillingAddress.name,
+ addressLine1: accountsReceivableBillingAddress.addressLine1,
+ addressLine2: accountsReceivableBillingAddress.addressLine2,
+ city: accountsReceivableBillingAddress.city,
+ stateProvince: accountsReceivableBillingAddress.state,
+ postalCode: accountsReceivableBillingAddress.postalCode,
+ countryCode: accountsReceivableBillingAddress.countryCode
+ }
+ : undefined
+ }
+ companyLabel="Seller"
+ counterParty={{
+ name: customerName,
+ addressLine1: customerAddressLine1,
+ addressLine2: customerAddressLine2,
+ city: customerCity,
+ stateProvince: customerStateProvince,
+ postalCode: customerPostalCode,
+ countryCode: customerCountryName
+ }}
+ counterPartyLabel="Buyer"
+ accountsReceivableEmail={companySettings?.accountsReceivableEmail}
+ />
- {/* Invoice Details */}
+ <ShipBillDetails
+ shipTo={{
+ name: shipmentCustomerName,
+ addressLine1: shipmentAddressLine1,
+ addressLine2: shipmentAddressLine2,
+ city: shipmentCity,
+ stateProvince: shipmentStateProvince,
+ postalCode: shipmentPostalCode,
+ countryCode: shipmentCountryName
+ }}
+ billTo={{
+ name: invoiceCustomerName,
+ addressLine1: invoiceAddressLine1,
+ addressLine2: invoiceAddressLine2,
+ city: invoiceCity,
+ stateProvince: invoiceStateProvince,
+ postalCode: invoicePostalCode,
+ countryCode: invoiceCountryName
+ }}
+ />
+
+ {/* Invoice Details & Notes */}
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("flex flex-row")}>
<View style={tw("w-1/2 p-3 border-r border-gray-200")}>
@@ -197,18 +194,27 @@ const SalesInvoicePDF = ({
<Text>Customer Ref: {salesInvoice.customerReference}</Text>
)}
{paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
+ {shippingMethod && <Text>Shipping: {shippingMethod.name}</Text>}
+ {salesInvoiceShipment?.shippingTermId && (
+ <Text>
+ Shipping Terms: {salesInvoiceShipment.shippingTermId}
+ </Text>
+ )}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Shipping
+ Notes
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {shippingMethod && <Text>Method: {shippingMethod.name}</Text>}
- {salesInvoiceShipment?.shippingTermId && (
- <Text>Terms: {salesInvoiceShipment.shippingTermId}</Text>
+ {Object.keys(salesInvoice?.externalNotes ?? {}).length > 0 ? (
+ <Note
+ content={(salesInvoice.externalNotes ?? {}) as JSONContent}
+ />
+ ) : (
+ <Text style={tw("text-gray-400")}>None</Text>
)}
</View>
</View>
@@ -355,16 +361,7 @@ const SalesInvoicePDF = ({
</View>
</View>
- {/* Notes & Terms */}
- <View style={tw("flex flex-col gap-3 w-full")}>
- {Object.keys(salesInvoice.externalNotes ?? {}).length > 0 && (
- <Note
- title="Notes"
- content={(salesInvoice.externalNotes ?? {}) as JSONContent}
- />
- )}
- <Note title="Standard Terms & Conditions" content={terms} />
- </View>
+ <Note title="Standard Terms & Conditions" content={terms} />
</Template>
);
};
diff --git a/packages/documents/src/pdf/SalesOrderPDF.tsx b/packages/documents/src/pdf/SalesOrderPDF.tsx
index 3c14c4ecca..55c0e55494 100644
--- a/packages/documents/src/pdf/SalesOrderPDF.tsx
+++ b/packages/documents/src/pdf/SalesOrderPDF.tsx
@@ -1,9 +1,9 @@
import type { Database } from "@carbon/database";
import type { JSONContent } from "@carbon/react";
-import { formatCityStatePostalCode } from "@carbon/utils";
+import { formatDate } from "@carbon/utils";
import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
-import type { PDF } from "../types";
+import type { AccountsReceivableBillingAddress, PDF } from "../types";
import {
getLineDescription,
getLineDescriptionDetails,
@@ -12,12 +12,22 @@ import {
getTotal
} from "../utils/sales-order";
import { getCurrencyFormatter } from "../utils/shared";
-import { Header, Note, Template } from "./components";
+import {
+ Header,
+ Note,
+ PartyDetails,
+ ShipBillDetails,
+ Template
+} from "./components";
interface SalesOrderPDFProps extends PDF {
salesOrder: Database["public"]["Views"]["salesOrders"]["Row"];
salesOrderLines: Database["public"]["Views"]["salesOrderLines"]["Row"][];
salesOrderLocations: Database["public"]["Views"]["salesOrderLocations"]["Row"];
+ companySettings?:
+ | Database["public"]["Tables"]["companySettings"]["Row"]
+ | null;
+ accountsReceivableBillingAddress?: AccountsReceivableBillingAddress | null;
paymentTerms: { id: string; name: string }[];
shippingMethods: { id: string; name: string }[];
terms: JSONContent;
@@ -44,7 +54,9 @@ const tw = createTw({
});
const SalesOrderPDF = ({
+ accountsReceivableBillingAddress,
company,
+ companySettings,
locale,
meta,
salesOrder,
@@ -84,20 +96,6 @@ const SalesOrderPDF = ({
(method) => method.id === salesOrder?.shippingMethodId
);
- const formatDate = (dateStr: string | null) => {
- if (!dateStr) return null;
- try {
- const date = new Date(dateStr);
- return date.toLocaleDateString("en-US", {
- year: "numeric",
- month: "long",
- day: "numeric"
- });
- } catch {
- return dateStr;
- }
- };
-
let rowIndex = 0;
return (
@@ -113,69 +111,61 @@ const SalesOrderPDF = ({
company={company}
title="Sales Order"
documentId={salesOrder?.salesOrderId}
+ date={salesOrder?.orderDate}
+ currencyCode={salesOrder?.currencyCode}
/>
- {/* Ship To & Bill To */}
- <View style={tw("border border-gray-200 mb-4")}>
- <View style={tw("flex flex-row")}>
- <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Ship To
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {customerName && (
- <Text style={tw("font-bold")}>{customerName}</Text>
- )}
- {customerAddressLine1 && (
- <Text style={tw("mt-1")}>{customerAddressLine1}</Text>
- )}
- {customerAddressLine2 && <Text>{customerAddressLine2}</Text>}
- {(customerCity ||
- customerStateProvince ||
- customerPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- customerCity,
- customerStateProvince,
- customerPostalCode
- )}
- </Text>
- )}
- {customerCountryName && <Text>{customerCountryName}</Text>}
- </View>
- </View>
- <View style={tw("w-1/2 p-3")}>
- <Text
- style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
- >
- Bill To
- </Text>
- <View style={tw("text-[10px] text-gray-800")}>
- {paymentCustomerName && (
- <Text style={tw("font-bold")}>{paymentCustomerName}</Text>
- )}
- {paymentAddressLine1 && (
- <Text style={tw("mt-1")}>{paymentAddressLine1}</Text>
- )}
- {paymentAddressLine2 && <Text>{paymentAddressLine2}</Text>}
- {(paymentCity || paymentStateProvince || paymentPostalCode) && (
- <Text>
- {formatCityStatePostalCode(
- paymentCity,
- paymentStateProvince,
- paymentPostalCode
- )}
- </Text>
- )}
- {paymentCountryName && <Text>{paymentCountryName}</Text>}
- </View>
- </View>
- </View>
- </View>
+ <PartyDetails
+ company={company}
+ companyAddressOverride={
+ accountsReceivableBillingAddress
+ ? {
+ name: accountsReceivableBillingAddress.name,
+ addressLine1: accountsReceivableBillingAddress.addressLine1,
+ addressLine2: accountsReceivableBillingAddress.addressLine2,
+ city: accountsReceivableBillingAddress.city,
+ stateProvince: accountsReceivableBillingAddress.state,
+ postalCode: accountsReceivableBillingAddress.postalCode,
+ countryCode: accountsReceivableBillingAddress.countryCode
+ }
+ : undefined
+ }
+ companyLabel="Seller"
+ counterParty={{
+ name: customerName,
+ addressLine1: customerAddressLine1,
+ addressLine2: customerAddressLine2,
+ city: customerCity,
+ stateProvince: customerStateProvince,
+ postalCode: customerPostalCode,
+ countryCode: customerCountryName
+ }}
+ counterPartyLabel="Buyer"
+ accountsReceivableEmail={companySettings?.accountsReceivableEmail}
+ />
+
+ <ShipBillDetails
+ shipTo={{
+ name: customerName,
+ addressLine1: customerAddressLine1,
+ addressLine2: customerAddressLine2,
+ city: customerCity,
+ stateProvince: customerStateProvince,
+ postalCode: customerPostalCode,
+ countryCode: customerCountryName
+ }}
+ billTo={{
+ name: paymentCustomerName,
+ addressLine1: paymentAddressLine1,
+ addressLine2: paymentAddressLine2,
+ city: paymentCity,
+ stateProvince: paymentStateProvince,
+ postalCode: paymentPostalCode,
+ countryCode: paymentCountryName
+ }}
+ />
- {/* Order Details */}
+ {/* Order Details & Notes */}
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("flex flex-row")}>
<View style={tw("w-1/2 p-3 border-r border-gray-200")}>
@@ -201,20 +191,27 @@ const SalesOrderPDF = ({
Promised: {formatDate(salesOrder.receiptPromisedDate)}
</Text>
)}
+ {shippingMethod && <Text>Shipping: {shippingMethod.name}</Text>}
+ {salesOrder?.shippingTermName && (
+ <Text>Shipping Terms: {salesOrder.shippingTermName}</Text>
+ )}
+ {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
>
- Shipping & Payment
+ Notes
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {shippingMethod && <Text>Method: {shippingMethod.name}</Text>}
- {salesOrder?.shippingTermName && (
- <Text>Terms: {salesOrder.shippingTermName}</Text>
+ {Object.keys(salesOrder?.externalNotes ?? {}).length > 0 ? (
+ <Note
+ content={(salesOrder.externalNotes ?? {}) as JSONContent}
+ />
+ ) : (
+ <Text style={tw("text-gray-400")}>None</Text>
)}
- {paymentTerm && <Text>Payment: {paymentTerm.name}</Text>}
</View>
</View>
</View>
@@ -355,16 +352,8 @@ const SalesOrderPDF = ({
</View>
</View>
- {/* Notes & Terms */}
- <View style={tw("flex flex-col gap-3 w-full")}>
- {Object.keys(salesOrder.externalNotes ?? {}).length > 0 && (
- <Note
- title="Notes"
- content={(salesOrder.externalNotes ?? {}) as JSONContent}
- />
- )}
- <Note title="Standard Terms & Conditions" content={terms} />
- </View>
+ {/* Terms */}
+ <Note title="Standard Terms & Conditions" content={terms} />
</Template>
);
};
diff --git a/packages/documents/src/pdf/StockTransferPDF.tsx b/packages/documents/src/pdf/StockTransferPDF.tsx
index 1d9dc2dc91..d2ac105a9a 100644
--- a/packages/documents/src/pdf/StockTransferPDF.tsx
+++ b/packages/documents/src/pdf/StockTransferPDF.tsx
@@ -79,7 +79,12 @@ const StockTransferPDF = ({
<View style={tw("flex flex-col")}>
{/* Header Section - Always at the top */}
<View style={tw("mb-4")}>
- <Header company={company} title={title} />
+ <Header
+ company={company}
+ title={title}
+ documentId={stockTransfer?.stockTransferId}
+ date={stockTransfer?.createdAt}
+ />
<Summary company={company} items={details} />
</View>
diff --git a/packages/documents/src/pdf/components/Header.tsx b/packages/documents/src/pdf/components/Header.tsx
index 96b7a6e165..70e9f24f02 100644
--- a/packages/documents/src/pdf/components/Header.tsx
+++ b/packages/documents/src/pdf/components/Header.tsx
@@ -1,4 +1,4 @@
-import { formatCityStatePostalCode } from "@carbon/utils";
+import { formatDate } from "@carbon/utils";
import { Image, Text, View } from "@react-pdf/renderer";
import { createTw } from "react-pdf-tailwind";
import type { Company } from "../../types";
@@ -7,6 +7,8 @@ type HeaderProps = {
company: Company;
title: string;
documentId?: string | null;
+ date?: string | null;
+ currencyCode?: string | null;
};
const tw = createTw({
@@ -28,7 +30,13 @@ const tw = createTw({
}
});
-const Header = ({ company, title, documentId }: HeaderProps) => {
+const Header = ({
+ company,
+ title,
+ documentId,
+ date,
+ currencyCode
+}: HeaderProps) => {
return (
<>
<View style={tw("flex flex-row justify-between mb-1")}>
@@ -49,28 +57,6 @@ const Header = ({ company, title, documentId }: HeaderProps) => {
</Text>
</View>
)}
-
- <View
- style={tw(
- "text-[10px] text-gray-600 {company.logoLightIcon ? 'mt-0.5' : '-mt-2'}"
- )}
- >
- {company.logoLightIcon && company.name && (
- <Text style={tw("font-semibold text-black")}>{company.name}</Text>
- )}
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
- <Text>
- {formatCityStatePostalCode(
- company.city,
- company.stateProvince,
- company.postalCode
- )}
- </Text>
- )}
- {company.phone && <Text>{company.phone}</Text>}
- {company.website && <Text>{company.website}</Text>}
- </View>
</View>
<View style={tw("flex flex-col items-end justify-start")}>
<Text style={tw("text-2xl font-bold text-gray-800 tracking-tight")}>
@@ -80,7 +66,17 @@ const Header = ({ company, title, documentId }: HeaderProps) => {
<Text
style={tw("text-sm font-bold text-gray-600 tracking-tight -mt-4")}
>
- #{documentId}
+ {documentId}
+ </Text>
+ )}
+ {date && (
+ <Text style={tw("text-sm font-bold text-gray-600 tracking-tight")}>
+ Date: {formatDate(date)}
+ </Text>
+ )}
+ {currencyCode && (
+ <Text style={tw("text-sm font-bold text-gray-600 tracking-tight")}>
+ Currency: {currencyCode}
</Text>
)}
</View>
diff --git a/packages/documents/src/pdf/components/PartyDetails.tsx b/packages/documents/src/pdf/components/PartyDetails.tsx
new file mode 100644
index 0000000000..bc7545dd55
--- /dev/null
+++ b/packages/documents/src/pdf/components/PartyDetails.tsx
@@ -0,0 +1,179 @@
+import type { Database } from "@carbon/database";
+import { formatCityStatePostalCode } from "@carbon/utils";
+import { Text, View } from "@react-pdf/renderer";
+import { createTw } from "react-pdf-tailwind";
+
+type CounterParty = {
+ name: string | null;
+ addressLine1: string | null;
+ addressLine2: string | null;
+ city: string | null;
+ stateProvince: string | null;
+ postalCode: string | null;
+ countryCode: string | null;
+ taxId?: string | null;
+ vatNumber?: string | null;
+ contactName?: string | null;
+ contactEmail?: string | null;
+};
+
+type CompanyAddressOverride = {
+ name: string | null;
+ addressLine1: string | null;
+ addressLine2: string | null;
+ city: string | null;
+ stateProvince: string | null;
+ postalCode: string | null;
+ countryCode: string | null;
+};
+
+type PartyDetailsProps = {
+ company: Database["public"]["Views"]["companies"]["Row"];
+ companyAddressOverride?: CompanyAddressOverride;
+ companyLabel: string;
+ counterParty: CounterParty;
+ counterPartyLabel: string;
+ createdByFullName?: string | null;
+ createdByEmail?: string | null;
+ accountsPayableEmail?: string | null;
+ accountsReceivableEmail?: string | null;
+};
+
+const tw = createTw({
+ theme: {
+ fontFamily: {
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
+ },
+ extend: {
+ colors: {
+ gray: {
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 600: "#4b5563",
+ 800: "#1f2937"
+ }
+ }
+ }
+ }
+});
+
+const PartyDetails = ({
+ company,
+ companyAddressOverride,
+ companyLabel,
+ counterParty,
+ counterPartyLabel,
+ createdByFullName,
+ createdByEmail,
+ accountsPayableEmail,
+ accountsReceivableEmail
+}: PartyDetailsProps) => {
+ const addr = companyAddressOverride ?? company;
+
+ return (
+ <View style={tw("border border-gray-200 mb-4")}>
+ <View style={tw("flex flex-row")}>
+ {/* Company */}
+ <View style={tw("w-1/2 p-3 border-r border-gray-200")}>
+ <Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
+ {companyLabel}
+ </Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {company.name && (
+ <Text style={tw("font-bold")}>{company.name}</Text>
+ )}
+ {companyAddressOverride?.name &&
+ companyAddressOverride.name !== company.name && (
+ <Text>{companyAddressOverride.name}</Text>
+ )}
+ {addr.addressLine1 && <Text>{addr.addressLine1}</Text>}
+ {addr.addressLine2 && <Text>{addr.addressLine2}</Text>}
+ {(addr.city ||
+ addr.stateProvince ||
+ addr.postalCode ||
+ addr.countryCode) && (
+ <Text>
+ {[
+ formatCityStatePostalCode(
+ addr.city,
+ addr.stateProvince,
+ addr.postalCode
+ ),
+ addr.countryCode
+ ]
+ .filter(Boolean)
+ .join(" ")}
+ </Text>
+ )}
+ {company.taxId && <Text>Tax ID: {company.taxId}</Text>}
+ {company.vatNumber && <Text>VAT Number: {company.vatNumber}</Text>}
+ {(createdByFullName || createdByEmail) && (
+ <Text>
+ Contact: {createdByFullName}
+ {createdByEmail ? ` (${createdByEmail})` : ""}
+ </Text>
+ )}
+ {accountsPayableEmail && (
+ <Text>Accounts Payable: {accountsPayableEmail}</Text>
+ )}
+ {accountsReceivableEmail && (
+ <Text>Accounts Receivable: {accountsReceivableEmail}</Text>
+ )}
+ </View>
+ </View>
+
+ {/* Counter Party (Supplier) */}
+ <View style={tw("w-1/2 p-3")}>
+ <Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
+ {counterPartyLabel}
+ </Text>
+ <View style={tw("text-[10px] text-gray-800")}>
+ {counterParty.name && (
+ <Text style={tw("font-bold")}>{counterParty.name}</Text>
+ )}
+ {counterParty.addressLine1 && (
+ <Text>{counterParty.addressLine1}</Text>
+ )}
+ {counterParty.addressLine2 && (
+ <Text>{counterParty.addressLine2}</Text>
+ )}
+ {(counterParty.city ||
+ counterParty.stateProvince ||
+ counterParty.postalCode ||
+ counterParty.countryCode) && (
+ <Text>
+ {[
+ formatCityStatePostalCode(
+ counterParty.city,
+ counterParty.stateProvince,
+ counterParty.postalCode
+ ),
+ counterParty.countryCode
+ ]
+ .filter(Boolean)
+ .join(" ")}
+ </Text>
+ )}
+ {counterParty.taxId && (
+ <Text>Company No: {counterParty.taxId}</Text>
+ )}
+ {counterParty.vatNumber && (
+ <Text>VAT No: {counterParty.vatNumber}</Text>
+ )}
+ {(counterParty.contactName || counterParty.contactEmail) && (
+ <Text>
+ Contact: {counterParty.contactName}
+ {counterParty.contactEmail
+ ? ` (${counterParty.contactEmail})`
+ : ""}
+ </Text>
+ )}
+ </View>
+ </View>
+ </View>
+ </View>
+ );
+};
+
+export { PartyDetails };
diff --git a/packages/documents/src/pdf/components/ShipBillDetails.tsx b/packages/documents/src/pdf/components/ShipBillDetails.tsx
new file mode 100644
index 0000000000..b87294e073
--- /dev/null
+++ b/packages/documents/src/pdf/components/ShipBillDetails.tsx
@@ -0,0 +1,98 @@
+import { formatCityStatePostalCode } from "@carbon/utils";
+import { Text, View } from "@react-pdf/renderer";
+import { createTw } from "react-pdf-tailwind";
+
+type Address = {
+ name: string | null;
+ addressLine1: string | null;
+ addressLine2: string | null;
+ city: string | null;
+ stateProvince: string | null;
+ postalCode: string | null;
+ countryCode: string | null;
+};
+
+type ShipBillDetailsProps = {
+ shipTo: Address;
+ shipToLabel?: string;
+ billTo?: Address;
+ billToLabel?: string;
+};
+
+const tw = createTw({
+ theme: {
+ fontFamily: {
+ sans: ["Inter", "Helvetica", "Arial", "sans-serif"]
+ },
+ extend: {
+ colors: {
+ gray: {
+ 50: "#f9fafb",
+ 200: "#e5e7eb",
+ 400: "#9ca3af",
+ 600: "#4b5563",
+ 800: "#1f2937"
+ }
+ }
+ }
+ }
+});
+
+const AddressBlock = ({ address }: { address: Address }) => (
+ <View style={tw("text-[10px] text-gray-800")}>
+ {address.name && <Text style={tw("font-bold")}>{address.name}</Text>}
+ {address.addressLine1 && <Text>{address.addressLine1}</Text>}
+ {address.addressLine2 && <Text>{address.addressLine2}</Text>}
+ {(address.city ||
+ address.stateProvince ||
+ address.postalCode ||
+ address.countryCode) && (
+ <Text>
+ {[
+ formatCityStatePostalCode(
+ address.city,
+ address.stateProvince,
+ address.postalCode
+ ),
+ address.countryCode
+ ]
+ .filter(Boolean)
+ .join(" ")}
+ </Text>
+ )}
+ </View>
+);
+
+const ShipBillDetails = ({
+ shipTo,
+ shipToLabel = "Ship To",
+ billTo,
+ billToLabel = "Bill To"
+}: ShipBillDetailsProps) => {
+ return (
+ <View style={tw("border border-gray-200 mb-4")}>
+ <View style={tw("flex flex-row")}>
+ <View
+ style={tw(`w-1/2 p-3${billTo ? " border-r border-gray-200" : ""}`)}
+ >
+ <Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
+ {shipToLabel}
+ </Text>
+ <AddressBlock address={shipTo} />
+ </View>
+ {billTo && (
+ <View style={tw("w-1/2 p-3")}>
+ <Text
+ style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
+ >
+ {billToLabel}
+ </Text>
+ <AddressBlock address={billTo} />
+ </View>
+ )}
+ </View>
+ </View>
+ );
+};
+
+export { ShipBillDetails };
diff --git a/packages/documents/src/pdf/components/index.ts b/packages/documents/src/pdf/components/index.ts
index a5e9be1656..4ccf57dd13 100644
--- a/packages/documents/src/pdf/components/index.ts
+++ b/packages/documents/src/pdf/components/index.ts
@@ -1,7 +1,17 @@
import Footer from "./Footer";
import { Header } from "./Header";
import Note from "./Note";
+import { PartyDetails } from "./PartyDetails";
+import { ShipBillDetails } from "./ShipBillDetails";
import Summary from "./Summary";
import Template from "./Template";
-export { Footer, Header, Note, Summary, Template };
+export {
+ Footer,
+ Header,
+ Note,
+ PartyDetails,
+ ShipBillDetails,
+ Summary,
+ Template
+};
diff --git a/packages/documents/src/types.ts b/packages/documents/src/types.ts
index 9972f9633d..c2d4b91e3b 100644
--- a/packages/documents/src/types.ts
+++ b/packages/documents/src/types.ts
@@ -28,8 +28,12 @@ export type Meta = {
subject?: string;
};
-export type Company = Database["public"]["Tables"]["company"]["Row"];
+export type Company = Database["public"]["Views"]["companies"]["Row"];
export type CompanySettings =
Database["public"]["Tables"]["companySettings"]["Row"];
export type QuoteCustomerDetails =
Database["public"]["Views"]["quoteCustomerDetails"]["Row"];
+export type AccountsPayableBillingAddress =
+ Database["public"]["Tables"]["companyAccountsPayableBillingAddress"]["Row"];
+export type AccountsReceivableBillingAddress =
+ Database["public"]["Tables"]["companyAccountsReceivableBillingAddress"]["Row"];