@react-pakistan/util-functions 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/edu-pilot-pro/calculate-student-fee-fine.d.mts +27 -0
  2. package/edu-pilot-pro/calculate-student-fee-fine.d.ts +27 -0
  3. package/edu-pilot-pro/calculate-student-fee-fine.js +1 -0
  4. package/edu-pilot-pro/calculate-student-fee-fine.mjs +1 -0
  5. package/edu-pilot-pro/types/academics.d.mts +2 -0
  6. package/edu-pilot-pro/types/academics.d.ts +2 -0
  7. package/edu-pilot-pro/types/academics.js +1 -0
  8. package/edu-pilot-pro/types/academics.mjs +0 -0
  9. package/edu-pilot-pro/types/admission.d.mts +878 -0
  10. package/edu-pilot-pro/types/admission.d.ts +878 -0
  11. package/edu-pilot-pro/types/admission.js +1 -0
  12. package/edu-pilot-pro/types/admission.mjs +0 -0
  13. package/edu-pilot-pro/types/communication.d.mts +2 -0
  14. package/edu-pilot-pro/types/communication.d.ts +2 -0
  15. package/edu-pilot-pro/types/communication.js +1 -0
  16. package/edu-pilot-pro/types/communication.mjs +0 -0
  17. package/edu-pilot-pro/types/enums.d.mts +413 -0
  18. package/edu-pilot-pro/types/enums.d.ts +413 -0
  19. package/edu-pilot-pro/types/enums.js +1 -0
  20. package/edu-pilot-pro/types/enums.mjs +1 -0
  21. package/edu-pilot-pro/types/finance.d.mts +2 -0
  22. package/edu-pilot-pro/types/finance.d.ts +2 -0
  23. package/edu-pilot-pro/types/finance.js +1 -0
  24. package/edu-pilot-pro/types/finance.mjs +0 -0
  25. package/edu-pilot-pro/types/index.d.mts +2 -0
  26. package/edu-pilot-pro/types/index.d.ts +2 -0
  27. package/edu-pilot-pro/types/index.js +1 -0
  28. package/edu-pilot-pro/types/index.mjs +1 -0
  29. package/edu-pilot-pro/types/user-management.d.mts +2 -0
  30. package/edu-pilot-pro/types/user-management.d.ts +2 -0
  31. package/edu-pilot-pro/types/user-management.js +1 -0
  32. package/edu-pilot-pro/types/user-management.mjs +0 -0
  33. package/package.json +2 -2
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Calculates the late fine for a student fee based on payment delay.
3
+ *
4
+ * Rules:
5
+ * - Returns 0 if the fee status is `CANCELLED` or `REFUNDED`.
6
+ * - Returns the existing `fee.fine` value if it is set and greater than 0.
7
+ * - Returns 0 if `perDateRate` ≤ 0 or `fee.amountDue` ≤ 0.
8
+ * - When payment is in the same calendar month as the due date, fine days = payment day - dueDateLength.
9
+ * - When payment crosses into a later month, fine days = days from the 1st of the due month to the last day of the month before payment.
10
+ * - Fine amount = fineDays × perDateRate × (amountDue / amount), rounded to 2 decimal places.
11
+ *
12
+ * @param fee - The fee object containing amount, amountDue, dueDate, optional fine and paidAt, and status
13
+ * @param dueDateLength - The day of the month after which a fine starts accruing (e.g. 10 means fine starts on the 11th)
14
+ * @param perDateRate - The fine rate per day
15
+ * @param asOf - Optional reference date used when paidAt is not provided (defaults to current date)
16
+ * @returns The calculated fine amount rounded to 2 decimal places
17
+ */
18
+ declare function calculateStudentFeeFine(fee: {
19
+ amount: number;
20
+ amountDue: number;
21
+ dueDate: Date;
22
+ fine?: number | null;
23
+ paidAt?: Date | null;
24
+ status: string;
25
+ }, dueDateLength: number, perDateRate: number, asOf?: Date): number;
26
+
27
+ export { calculateStudentFeeFine };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Calculates the late fine for a student fee based on payment delay.
3
+ *
4
+ * Rules:
5
+ * - Returns 0 if the fee status is `CANCELLED` or `REFUNDED`.
6
+ * - Returns the existing `fee.fine` value if it is set and greater than 0.
7
+ * - Returns 0 if `perDateRate` ≤ 0 or `fee.amountDue` ≤ 0.
8
+ * - When payment is in the same calendar month as the due date, fine days = payment day - dueDateLength.
9
+ * - When payment crosses into a later month, fine days = days from the 1st of the due month to the last day of the month before payment.
10
+ * - Fine amount = fineDays × perDateRate × (amountDue / amount), rounded to 2 decimal places.
11
+ *
12
+ * @param fee - The fee object containing amount, amountDue, dueDate, optional fine and paidAt, and status
13
+ * @param dueDateLength - The day of the month after which a fine starts accruing (e.g. 10 means fine starts on the 11th)
14
+ * @param perDateRate - The fine rate per day
15
+ * @param asOf - Optional reference date used when paidAt is not provided (defaults to current date)
16
+ * @returns The calculated fine amount rounded to 2 decimal places
17
+ */
18
+ declare function calculateStudentFeeFine(fee: {
19
+ amount: number;
20
+ amountDue: number;
21
+ dueDate: Date;
22
+ fine?: number | null;
23
+ paidAt?: Date | null;
24
+ status: string;
25
+ }, dueDateLength: number, perDateRate: number, asOf?: Date): number;
26
+
27
+ export { calculateStudentFeeFine };
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(t,n)=>{for(var a in n)o(t,a,{get:n[a],enumerable:!0})},M=(t,n,a,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of d(n))!g.call(t,e)&&e!==a&&o(t,e,{get:()=>n[e],enumerable:!(u=c(n,e))||u.enumerable});return t};var b=t=>M(o({},"__esModule",{value:!0}),t);var f={};h(f,{calculateStudentFeeFine:()=>p});module.exports=b(f);function y(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()}function F(t,n){return Math.round((n.getTime()-t.getTime())/(1e3*60*60*24))}function p(t,n,a,u){if(t.status==="CANCELLED"||t.status==="REFUNDED")return 0;if(t.fine!=null&&t.fine>0)return t.fine;if(a<=0||t.amountDue<=0)return 0;const e=t.paidAt??u??new Date,m=y(t.dueDate,e);let r;if(m){if(r=e.getDate()-n,r<=0)return 0}else{const D=new Date(t.dueDate.getFullYear(),t.dueDate.getMonth(),1),s=new Date(e.getFullYear(),e.getMonth(),0);r=F(D,s)+1}const i=t.amount>0?t.amountDue/t.amount:0,l=r*a*i;return Math.round(l*100)/100}0&&(module.exports={calculateStudentFeeFine});
@@ -0,0 +1 @@
1
+ function s(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()}function c(t,n){return Math.round((n.getTime()-t.getTime())/(1e3*60*60*24))}function d(t,n,u,o){if(t.status==="CANCELLED"||t.status==="REFUNDED")return 0;if(t.fine!=null&&t.fine>0)return t.fine;if(u<=0||t.amountDue<=0)return 0;const e=t.paidAt??o??new Date,D=s(t.dueDate,e);let a;if(D){if(a=e.getDate()-n,a<=0)return 0}else{const r=new Date(t.dueDate.getFullYear(),t.dueDate.getMonth(),1),l=new Date(e.getFullYear(),e.getMonth(),0);a=c(r,l)+1}const m=t.amount>0?t.amountDue/t.amount:0,i=a*u*m;return Math.round(i*100)/100}export{d as calculateStudentFeeFine};
@@ -0,0 +1,2 @@
1
+ import './enums.mjs';
2
+ export { A as AttendanceBE, o as ClassBE, p as CourseBE, q as EnrollmentBE, r as FamilyBE, s as FamilyMemberBE, G as GradeBE, t as ScheduleBE, u as SectionBE, v as StudentProfileBE, w as SubjectBE, T as TeacherBE } from './admission.mjs';
@@ -0,0 +1,2 @@
1
+ import './enums.js';
2
+ export { A as AttendanceBE, o as ClassBE, p as CourseBE, q as EnrollmentBE, r as FamilyBE, s as FamilyMemberBE, G as GradeBE, t as ScheduleBE, u as SectionBE, v as StudentProfileBE, w as SubjectBE, T as TeacherBE } from './admission.js';
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!a.call(t,n)&&n!==i&&s(t,n,{get:()=>e[n],enumerable:!(r=l(e,n))||r.enumerable});return t};var g=t=>d(s({},"__esModule",{value:!0}),t);var u={};module.exports=g(u);
File without changes