@@ -121,7 +121,7 @@ function generatePdf(invoiceObj) {
121
121
. text ( invoiceObj . payment_id ?? null , posx . payment . id . x , posx . payment . id . y ) ;
122
122
123
123
invoiceObj . treatments . forEach ( ( trt , ind ) => {
124
- let currentHeight = posx . table . body . base_proc . y + 64 * ind ;
124
+ let currentHeight = posx . table . body . base_proc . y + 60 * ind ;
125
125
doc
126
126
. text ( trt . procedure_done , posx . table . body . base_proc . x , currentHeight , {
127
127
width : posx . table . body . base_proc . max_width ,
@@ -147,12 +147,23 @@ function generatePdf(invoiceObj) {
147
147
. text ( `${ invoiceObj . patient . age } / ${ invoiceObj . patient . gender } ` )
148
148
. text ( invoiceObj . patient . contact )
149
149
. text ( "Doctor:" , posx . data . doctor . x , posx . data . doctor . y )
150
- . text ( invoiceObj . created_at , posx . data . date . x , posx . data . date . y , { align : 'right' } )
151
150
. text ( "Sub Total: Rs." , posx . total_foot . x , posx . total_foot . sub_y )
152
- . text ( "Grand Total: Rs." , posx . total_foot . x , posx . total_foot . grand_y ) ;
151
+ . text ( "Grand Total: Rs." , posx . total_foot . x , posx . total_foot . grand_y )
152
+ . fontSize ( 10 ) // 10 REGULAR BLACK (SUB TEXT)
153
+ . text (
154
+ `Generated on ${ invoiceObj . created_at . toLocaleString ( "default" , {
155
+ day : "numeric" ,
156
+ month : "numeric" ,
157
+ year : "numeric" ,
158
+ hour : "numeric" ,
159
+ minute : "numeric" ,
160
+ hour12 : true
161
+ } ) } `,
162
+ posx . data . date . x , posx . data . date . y , { align : "center" }
163
+ ) ;
153
164
154
165
// 14 SEMIBOLD BLACK
155
- doc . font ( path . join ( miscPath , 'ProximaNova-Semibold.ttf' ) )
166
+ doc . fontSize ( 14 ) . font ( path . join ( miscPath , 'ProximaNova-Semibold.ttf' ) )
156
167
. text ( invoiceObj . doctor . join ( ', ' ) , posx . data . doctor . name_x , posx . data . doctor . y )
157
168
. text ( invoiceObj . patient . p_id , posx . data . patient . pid . x , posx . data . patient . pid . y , { align : 'right' } )
158
169
. text ( ! _ . isNil ( invoiceObj . sub_total )
@@ -214,11 +225,11 @@ async function NewInvoiceHandler(pid, body) {
214
225
p_id : pid ,
215
226
doctor : _ . chain ( body . treatments ) . map ( 'doctor' ) . uniq ( ) . value ( ) ,
216
227
treatments : body . treatments . map ( JSON . stringify ) ,
217
- payment_method : _ . has ( body , "payment_method" ) ? body . payment_method : null ,
218
- payment_id : _ . has ( body , "payment_id" ) ? body . payment_id : null ,
219
- sub_total : _ . has ( body , "sub_total" ) ? body . sub_total : null ,
220
- discount : _ . has ( body , "discount" ) ? body . discount : null ,
221
- grand_total : _ . has ( body , "grand_total" ) ? body . grand_total : null
228
+ payment_method : _ . has ( body , "payment_method" ) ? body . payment_method : null ,
229
+ payment_id : _ . has ( body , "payment_id" ) ? body . payment_id : null ,
230
+ sub_total : _ . has ( body , "sub_total" ) ? body . sub_total : null ,
231
+ discount : _ . has ( body , "discount" ) ? body . discount : null ,
232
+ grand_total : _ . has ( body , "grand_total" ) ? body . grand_total : null
222
233
} ;
223
234
invoiceObj = sanitize ( invoiceObj ) ;
224
235
invoiceObj . inv_id = await makeNextInvid ( db ) ;
0 commit comments