10
10
11
11
from project_reports .models import ActivityPlanReport , ProjectMonthlyReport , ResponseType
12
12
from rh .models import (
13
- Currency ,
14
13
Disaggregation ,
15
14
FacilitySiteType ,
16
15
GrantType ,
17
16
ImplementationModalityType ,
18
17
PackageType ,
18
+ RationSize ,
19
+ RationType ,
19
20
TransferCategory ,
20
21
TransferMechanismType ,
21
22
UnitType ,
@@ -288,12 +289,13 @@ def write_import_report_template_sheet(workbook, monthly_report):
288
289
{"header" : "response_types" , "type" : "string" , "width" : 30 },
289
290
{"header" : "implementing_partners" , "type" : "string" , "width" : 30 },
290
291
{"header" : "package_type" , "type" : "string" , "width" : 30 },
292
+ {"header" : "ration_type" , "type" : "string" , "width" : 30 },
293
+ {"header" : "ration_size" , "type" : "string" , "width" : 30 },
291
294
{"header" : "unit_type" , "type" : "string" , "width" : 30 },
292
- {"header" : "units" , "type" : "string" , "width" : 30 },
295
+ {"header" : "units/transfer_value " , "type" : "string" , "width" : 30 },
293
296
{"header" : "no_of_transfers" , "type" : "string" , "width" : 30 },
294
297
{"header" : "grant_type" , "type" : "string" , "width" : 30 },
295
298
{"header" : "transfer_category" , "type" : "string" , "width" : 30 },
296
- {"header" : "currency" , "type" : "string" , "width" : 30 },
297
299
{"header" : "transfer_mechanism_type" , "type" : "string" , "width" : 30 },
298
300
{"header" : "implement_modility_type" , "type" : "string" , "width" : 30 },
299
301
{"header" : "beneficiary_status" , "type" : "string" , "width" : 30 },
@@ -311,7 +313,6 @@ def write_import_report_template_sheet(workbook, monthly_report):
311
313
{"header" : "facility_name" , "type" : "string" , "width" : 30 },
312
314
{"header" : "facility_lat" , "type" : "string" , "width" : 30 },
313
315
{"header" : "facility_long" , "type" : "string" , "width" : 30 },
314
- {"header" : "non_hrp_beneficiary" , "type" : "string" , "width" : 30 },
315
316
{"header" : "hrp_beneficiary" , "type" : "string" , "width" : 30 },
316
317
{"header" : "with_safe_spaces" , "type" : "string" , "width" : 30 },
317
318
]
@@ -338,30 +339,30 @@ def write_import_report_template_sheet(workbook, monthly_report):
338
339
sheet .column_dimensions [column_letter ].width = column ["width" ]
339
340
# write the rows with report data
340
341
container_dictionary = {
341
- "beneficiary_status_list" : ["P" , "New Beneficiary" , "Existing Beneficiaries" ],
342
342
"reponseTypeList" : ["E" ],
343
343
"package_type" : ["G" ],
344
- "unit_type" : ["H" ],
345
- "grant_type" : ["K" ],
346
- "im_modility_type" : ["O" ],
347
- "transfer_mc_type" : ["N" ],
348
- "transfer_category" : ["L" ],
349
- "currency" : ["M" ],
344
+ "ration_type" : ["H" ],
345
+ "ration_size" : ["I" ],
346
+ "unit_type" : ["J" ],
347
+ "grant_type" : ["M" ],
348
+ "transfer_category" : ["N" ],
349
+ "transfer_mc_type" : ["O" ],
350
+ "im_modility_type" : ["P" ],
351
+ "beneficiary_status_list" : ["Q" , "New Beneficiary" , "Existing Beneficiaries" ],
350
352
"safe_space" : ["AG" , "True" , "False" ],
351
- "facilitySiteTypeList" : ["Z " ],
353
+ "facilitySiteTypeList" : ["AA " ],
352
354
}
353
355
plain_dictionary_lists = {
354
356
"indicatorList" : ["B" ],
355
357
"activityDomainList" : ["C" ],
356
358
"activityTypeList" : ["D" ],
357
- "admin0nameList" : ["R " ],
358
- "admin0pcodeList" : ["S " ],
359
- "admin1pcodeList" : ["T " ],
360
- "admin1nameList" : ["U " ],
361
- "admin2pcodeList" : ["V " ],
362
- "admin2nameList" : ["W " ],
359
+ "admin0nameList" : ["S " ],
360
+ "admin0pcodeList" : ["T " ],
361
+ "admin1pcodeList" : ["U " ],
362
+ "admin1nameList" : ["V " ],
363
+ "admin2pcodeList" : ["W " ],
364
+ "admin2nameList" : ["X " ],
363
365
"implementing_partner_list" : ["F" ],
364
- "non_hrp_beneficiary" : ["AE" ],
365
366
"hrp_beneficiary" : ["AF" ],
366
367
}
367
368
project = monthly_report .project
@@ -371,9 +372,11 @@ def write_import_report_template_sheet(workbook, monthly_report):
371
372
container_dictionary ["im_modility_type" ].extend (
372
373
list (ImplementationModalityType .objects .values_list ("name" , flat = True ))
373
374
)
375
+ container_dictionary ["ration_size" ].extend (list (RationSize .objects .values_list ("name" , flat = True ).order_by ("-id" )))
376
+ container_dictionary ["ration_type" ].extend (list (RationType .objects .values_list ("name" , flat = True )))
374
377
container_dictionary ["transfer_mc_type" ].extend (list (TransferMechanismType .objects .values_list ("name" , flat = True )))
375
378
container_dictionary ["transfer_category" ].extend (list (TransferCategory .objects .values_list ("name" , flat = True )))
376
- container_dictionary [ "currency" ]. extend ( list ( Currency . objects . values_list ( "name" , flat = True )))
379
+
377
380
facility = list (FacilitySiteType .objects .filter (cluster__code = "health" ).values_list ("name" , flat = True ))
378
381
responseType = list (ResponseType .objects .values_list ("name" , flat = True ))
379
382
num_rows = 2
@@ -399,7 +402,6 @@ def write_import_report_template_sheet(workbook, monthly_report):
399
402
plain_dictionary_lists ["implementing_partner_list" ].append (
400
403
str (location .implementing_partner .code if location .implementing_partner else "" )
401
404
)
402
- plain_dictionary_lists ["non_hrp_beneficiary" ].append (str (plan .beneficiary if plan .beneficiary else "" ))
403
405
plain_dictionary_lists ["hrp_beneficiary" ].append (str (plan .hrp_beneficiary if plan .hrp_beneficiary else "" ))
404
406
num_rows += 1
405
407
0 commit comments