Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
PFM-4085,PFM-4082 added S.No
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldevgarg committed Feb 4, 2024
1 parent bf737ea commit 65d6a1b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
50 changes: 39 additions & 11 deletions frontend/mgramseva/lib/providers/reports_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class ReportsProvider with ChangeNotifier {
selectedBillCycle = null;
billingcycleCtrl.clear();
billingyearCtrl.clear();
demandreports = [];
collectionreports = [];
inactiveconsumers = [];
expenseBillReportData = [];
vendorReportData = [];
notifyListeners();
}

Expand Down Expand Up @@ -110,10 +115,10 @@ class ReportsProvider with ChangeNotifier {
];

List<TableHeader> get vendorReportHeaderList => [
TableHeader(i18.common.BILL_ID),
TableHeader(i18.expense.VENDOR_NAME),
TableHeader(i18.common.MOBILE_NUMBER),
TableHeader(i18.expense.EXPENSE_TYPE),
TableHeader(i18.common.BILL_ID),
];

void onChangeOfPageLimit(
Expand Down Expand Up @@ -245,10 +250,10 @@ class ReportsProvider with ChangeNotifier {
String? typeOfExpense = CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!);
String? billId = CommonMethods.truncateWithEllipsis(20, data.billId!);
return TableDataRow([
TableData('${billId ?? '-'}'),
TableData('${vendorName ?? '-'}'),
TableData('${data.mobileNo ?? '-'}'),
TableData('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'),
TableData('${billId ?? '-'}'),
]);
}

Expand All @@ -263,6 +268,11 @@ class ReportsProvider with ChangeNotifier {
billingcycleCtrl.clear();
selectedBillCycle = null;
selectedBillPeriod = null;
demandreports = [];
collectionreports = [];
inactiveconsumers = [];
expenseBillReportData = [];
vendorReportData = [];
notifyListeners();
}

Expand All @@ -279,6 +289,11 @@ class ReportsProvider with ChangeNotifier {
.toLocal()
.toString(),
dateFormat: "dd/MM/yyyy");
demandreports = [];
collectionreports = [];
inactiveconsumers = [];
expenseBillReportData = [];
vendorReportData = [];
notifyListeners();
}

Expand Down Expand Up @@ -745,6 +760,7 @@ class ReportsProvider with ChangeNotifier {
//Create a Excel document.

//Creating a workbook.
headers.insert(0, '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.S_NO)}');
final Workbook workbook = Workbook();
//Accessing via index
final Worksheet sheet = workbook.worksheets[0];
Expand All @@ -754,20 +770,25 @@ class ReportsProvider with ChangeNotifier {
sheet.enableSheetCalculations();
int dataStartRow = 2;
int headersStartRow = 1;
// //Set data in the worksheet.
// //Set data in the worksheet.s
if (optionalData.isEmpty) {
sheet.getRangeByName('A1:D1').columnWidth = 32.5;
sheet.getRangeByName('A1:D1').cellStyle.hAlign = HAlignType.center;
} else {
sheet.getRangeByName('A1:D1').columnWidth = 32.5;
sheet.getRangeByName('A2:D2').columnWidth = 32.5;
sheet.getRangeByName('A2:D2').cellStyle.hAlign = HAlignType.center;
sheet.getRangeByName('A1:A${tableData.length+1}').columnWidth = 12.5;
sheet.getRangeByName('A1:A${tableData.length+1}').cellStyle.hAlign = HAlignType.center;
sheet.getRangeByName('A1:A${tableData.length+1}').autoFit();
sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').columnWidth = 32.5;
sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').cellStyle.hAlign = HAlignType.center;
sheet.getRangeByName('B2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').columnWidth = 32.5;
sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.hAlign = HAlignType.center;
sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.bold = true;
dataStartRow = 3;
headersStartRow = 2;
for (int i = 0; i < optionalData.length; i++) {
sheet
.getRangeByName(
'${CommonMethods.getAlphabetsWithKeyValue()[i].label}1')
'${CommonMethods.getAlphabetsWithKeyValue()[i+1].label}1')
.setText(
optionalData[CommonMethods.getAlphabetsWithKeyValue()[i].key]);
}
Expand All @@ -782,10 +803,17 @@ class ReportsProvider with ChangeNotifier {

for (int i = dataStartRow; i < tableData.length + dataStartRow; i++) {
for (int j = 0; j < headers.length; j++) {
sheet
.getRangeByName(
'${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i')
.setText(tableData[i - dataStartRow][j]);
if(j==0){
sheet
.getRangeByName(
'${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i')
.setText('${i - dataStartRow+1}');
}else{
sheet
.getRangeByName(
'${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i')
.setText(tableData[i - dataStartRow][j - 1]);
}
sheet
.getRangeByName(
'${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i')
Expand Down
4 changes: 4 additions & 0 deletions frontend/mgramseva/lib/screeens/reports/reports.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class _Reports extends State<Reports> with SingleTickerProviderStateMixin {
navigatorKey.currentContext!,
listen: false);
reportsProvider.getFinancialYearList();
reportsProvider.clearBillingSelection();
reportsProvider.clearBuildTableData();
reportsProvider.clearTableData();

}

showTable(bool status, String title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Login {
class Common {
const Common();
String get CONTINUE => 'CORE_COMMON_CONTINUE';
String get S_NO => 'S_NO';
String get LAST_BILL_CYCLE_MONTH => 'LAST_BILL_CYCLE_MONTH';
String get CONSUMER_COUNT => 'CONSUMER_COUNT';
String get LAST_BILL_CYCLE_DEMAND_NOT_GENERATED => 'LAST_BILL_CYCLE_DEMAND_NOT_GENERATED';
Expand Down

0 comments on commit 65d6a1b

Please sign in to comment.