updaed billed field

This commit is contained in:
2025-06-02 18:48:35 +05:30
parent 84ccaa5ada
commit e147481215

View File

@@ -91,8 +91,8 @@ interface ClaimFormData {
serviceDate: string; // YYYY-MM-DD serviceDate: string; // YYYY-MM-DD
insuranceProvider: string; insuranceProvider: string;
status: string; // default "pending" status: string; // default "pending"
massdhp_username?:string, massdhp_username?: string;
massdhp_password?:string, massdhp_password?: string;
serviceLines: ServiceLine[]; serviceLines: ServiceLine[];
} }
@@ -186,7 +186,6 @@ export function ClaimForm({
} }
}, [extractedData]); }, [extractedData]);
// Update service date when calendar date changes // Update service date when calendar date changes
const onServiceDateChange = (date: Date | undefined) => { const onServiceDateChange = (date: Date | undefined) => {
if (date) { if (date) {
@@ -282,7 +281,9 @@ export function ClaimForm({
if (updatedLines[index]) { if (updatedLines[index]) {
if (field === "billedAmount") { if (field === "billedAmount") {
updatedLines[index][field] = parseFloat(value) || 0; const num = typeof value === "string" ? parseFloat(value) : value;
const rounded = Math.round((isNaN(num) ? 0 : num) * 100) / 100;
updatedLines[index][field] = rounded;
} else { } else {
updatedLines[index][field] = value; updatedLines[index][field] = value;
} }
@@ -334,14 +335,8 @@ export function ClaimForm({
setIsUploading(false); setIsUploading(false);
}; };
// Delta MA Button Handler // Mass Health Button Handler
const handleDeltaMASubmit = async () => { const handleMHSubmit = async () => {
function convertToISODate(mmddyyyy: string): string {
const [month, day, year] = mmddyyyy.split("/");
return `${year}-${month?.padStart(2, "0")}-${day?.padStart(2, "0")}`;
}
const appointmentData = { const appointmentData = {
patientId: patientId, patientId: patientId,
date: serviceDate, date: serviceDate,
@@ -357,7 +352,7 @@ export function ClaimForm({
const updatedPatientFields = { const updatedPatientFields = {
id, id,
...sanitizedFields, ...sanitizedFields,
insuranceProvider: "Delta MA", insuranceProvider: "MassHealth",
}; };
onHandleUpdatePatient(updatedPatientFields); onHandleUpdatePatient(updatedPatientFields);
} else { } else {
@@ -369,12 +364,17 @@ export function ClaimForm({
} }
// 3. Create Claim(if not) // 3. Create Claim(if not)
const { uploadedFiles, massdhp_username, massdhp_password, ...formToCreateClaim } = form; const {
uploadedFiles,
massdhp_username,
massdhp_password,
...formToCreateClaim
} = form;
onSubmit({ onSubmit({
...formToCreateClaim, ...formToCreateClaim,
staffId: Number(staff?.id), staffId: Number(staff?.id),
patientId: patientId, patientId: patientId,
insuranceProvider: "Delta MA", insuranceProvider: "MassHealth",
appointmentId: appointmentId!, appointmentId: appointmentId!,
}); });
@@ -383,7 +383,7 @@ export function ClaimForm({
...form, ...form,
staffId: Number(staff?.id), staffId: Number(staff?.id),
patientId: patientId, patientId: patientId,
insuranceProvider: "Delta MA", insuranceProvider: "Mass Health",
appointmentId: appointmentId!, appointmentId: appointmentId!,
massdhp_username: "kqkgaox@yahoo.com", massdhp_username: "kqkgaox@yahoo.com",
massdhp_password: "Lex123456", //fetch this from db, by call massdhp_password: "Lex123456", //fetch this from db, by call
@@ -606,12 +606,22 @@ export function ClaimForm({
} }
/> />
<Input <Input
placeholder="$0.00"
type="number" type="number"
value={line.billedAmount} step="0.01"
onChange={(e) => placeholder="$0.00"
updateServiceLine(i, "billedAmount", e.target.value) value={line.billedAmount === 0 ? "" : line.billedAmount}
} onChange={(e) => {
updateServiceLine(i, "billedAmount", e.target.value);
}}
onBlur={(e) => {
const val = parseFloat(e.target.value);
const rounded = Math.round(val * 100) / 100;
updateServiceLine(
i,
"billedAmount",
isNaN(rounded) ? 0 : rounded
);
}}
/> />
</div> </div>
))} ))}
@@ -697,12 +707,12 @@ export function ClaimForm({
<Button <Button
className="w-32" className="w-32"
variant="outline" variant="outline"
onClick={handleDeltaMASubmit} onClick={handleMHSubmit}
> >
Delta MA MH
</Button> </Button>
<Button className="w-32" variant="outline"> <Button className="w-32" variant="outline">
MH Delta MA
</Button> </Button>
<Button className="w-32" variant="outline"> <Button className="w-32" variant="outline">
Others Others