diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-05 11:44:32 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-05 11:44:32 +0000 |
| commit | 50adedf48ee4674ebe00f1ee72d93485183cdc51 (patch) | |
| tree | 18053ab04d94c750028eee5d5d2f16ba4f38f50e /lib/procurement-select/service.ts | |
| parent | 66d64b482f2b6b52b0dd396ef998f27d491c70dd (diff) | |
(대표님, 최겸, 임수민) EDP 입력 진행률, 견적목록관리, EDP excel import 오류수정, GTC-Contract
Diffstat (limited to 'lib/procurement-select/service.ts')
| -rw-r--r-- | lib/procurement-select/service.ts | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/lib/procurement-select/service.ts b/lib/procurement-select/service.ts new file mode 100644 index 00000000..14fe54d7 --- /dev/null +++ b/lib/procurement-select/service.ts @@ -0,0 +1,85 @@ +'use server' + +import db from "@/db/db" +import { + incoterms, placeOfShipping, paymentTerms +} from "@/db/schema" +import { eq } from "drizzle-orm" + +export async function getIncotermsForSelection() { + try { + const data = await db + .select({ + code: incoterms.code, + description: incoterms.description, + }) + .from(incoterms) + .where(eq(incoterms.isActive, true)) + .orderBy(incoterms.code) + + return data + + } catch (error) { + console.error("Error fetching incoterms:", error) + throw new Error("Failed to fetch incoterms") + } +} + + +export async function getPaymentTermsForSelection() { + try { + const data = await db + .select({ + code: paymentTerms.code, + description: paymentTerms.description, + }) + .from(paymentTerms) + .where(eq(paymentTerms.isActive, true)) + .orderBy(paymentTerms.code) + + return data + + } catch (error) { + console.error("Error fetching paymentTerms:", error) + throw new Error("Failed to fetch paymentTerms") + } +} + + +export async function getPlaceOfShippingForSelection() { + try { + const data = await db + .select({ + code: placeOfShipping.code, + description: placeOfShipping.description, + }) + .from(placeOfShipping) + .where(eq(placeOfShipping.isActive, true)) + .orderBy(placeOfShipping.code) + + return data + + } catch (error) { + console.error("Error fetching placeOfShipping:", error) + throw new Error("Failed to fetch placeOfShipping") + } +} + +export async function getPlaceOfDestinationForSelection() { + try { + const data = await db + .select({ + code: placeOfShipping.code, + description: placeOfShipping.description, + }) + .from(placeOfShipping) + .where(eq(placeOfShipping.isActive, true)) + .orderBy(placeOfShipping.code) + + return data + + } catch (error) { + console.error("Error fetching placeOfShipping:", error) + throw new Error("Failed to fetch placeOfShipping") + } +}
\ No newline at end of file |
