Spaces:
Sleeping
Sleeping
| import { z } from "zod"; | |
| // Party Schema | |
| export const partySchema = z.object({ | |
| name: z.string().min(1, "Party name is required").max(100), | |
| contactNumber: z.string().optional(), | |
| address: z.string().optional(), | |
| gstNumber: z.string().optional(), | |
| }); | |
| // Invoice Schema | |
| export const invoiceSchema = z.object({ | |
| partyName: z.string().min(1, "Party name is required"), | |
| date: z.string().min(1, "Date is required"), | |
| serialNumber: z.string().min(1, "Serial number is required"), | |
| lotNumber: z.string().min(1, "Lot number is required"), | |
| particular: z.string().min(1, "Product is required"), | |
| bags: z.number().min(1, "Bags must be at least 1"), | |
| grossWeight: z.number().min(1, "Gross weight is required"), | |
| rate: z.number().min(0, "Rate must be positive"), | |
| bardhana: z.number().min(0).default(18), | |
| hamali: z.number().min(0).default(6), | |
| adhath: z.number().min(0).max(100).default(0), | |
| cess: z.number().min(0).max(100).default(0), | |
| gaadiBharni: z.number().min(0).default(0), | |
| }); | |
| // Purchase Entry (AWAK) Schema | |
| export const purchaseSchema = z.object({ | |
| partyName: z.string().min(1, "Party name is required"), | |
| date: z.string().min(1, "Date is required"), | |
| lotNumber: z.string().min(1, "Lot number is required"), | |
| particular: z.string().min(1, "Product is required"), | |
| ssl: z.string().optional(), | |
| quality: z.string().optional(), | |
| bags: z.number().min(1, "Bags must be at least 1"), | |
| grossWeight: z.number().min(1, "Gross weight is required"), | |
| rate: z.number().min(0, "Rate must be positive"), | |
| totalAmount: z.number().min(0, "Total amount is required"), | |
| advancePaid: z.number().min(0).default(0), | |
| vehicleNumber: z.string().optional(), | |
| remarks: z.string().optional(), | |
| }); | |
| // Payment Schema | |
| export const paymentSchema = z.object({ | |
| partyName: z.string().min(1, "Party name is required"), | |
| date: z.string().min(1, "Date is required"), | |
| amount: z.number().min(0, "Amount must be positive"), | |
| type: z.enum(["received", "paid"]), | |
| mode: z.enum(["cash", "cheque", "bank", "upi"]), | |
| reference: z.string().optional(), | |
| remarks: z.string().optional(), | |
| }); | |
| // Bill Book Schema | |
| export const billBookSchema = z.object({ | |
| bookName: z.string().min(1, "Book name is required"), | |
| startNumber: z.number().min(1, "Start number is required"), | |
| endNumber: z.number().min(1, "End number is required"), | |
| currentNumber: z.number().min(1, "Current number is required"), | |
| isActive: z.boolean().default(true), | |
| }); | |
| // Stock Entry Schema | |
| export const stockEntrySchema = z.object({ | |
| type: z.enum(["awak", "jawak", "return"]), | |
| particular: z.string().min(1, "Product is required"), | |
| lotNumber: z.string().min(1, "Lot number is required"), | |
| bags: z.number().min(1, "Bags must be at least 1"), | |
| weight: z.number().min(1, "Weight is required"), | |
| rate: z.number().min(0, "Rate must be positive"), | |
| date: z.string().min(1, "Date is required"), | |
| partyName: z.string().min(1, "Party name is required"), | |
| }); | |
| export type Party = z.infer<typeof partySchema>; | |
| export type Invoice = z.infer<typeof invoiceSchema>; | |
| export type Purchase = z.infer<typeof purchaseSchema>; | |
| export type Payment = z.infer<typeof paymentSchema>; | |
| export type BillBook = z.infer<typeof billBookSchema>; | |
| export type StockEntry = z.infer<typeof stockEntrySchema>; | |