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

Develop #718

Merged
merged 5 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class BillGenerationProvider with ChangeNotifier {
billGenerateDetails.billYear = null;
selectedBillCycle = null;
billGenerateDetails.billCycle = null;
selectedBillPeriod = null;
notifyListeners();
}
void onChangeOfBillCycle(cycle) {
Expand Down Expand Up @@ -360,47 +361,48 @@ class BillGenerationProvider with ChangeNotifier {
navigatorKey.currentContext!,
listen: false);
var rate = rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').toList();
showDialog(context: context, builder: (context)=>AlertDialog(
surfaceTintColor: Colors.white,
title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'),
content: Container(
height: 370,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '),
SizedBox(height: 10,),
FittedBox(
child: DataTable(
border: TableBorder.all(
if(selectedBillPeriod!=null){
showDialog(context: context, builder: (context)=>AlertDialog(
surfaceTintColor: Colors.white,
title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'),
content: Container(
height: 370,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '),
SizedBox(height: 10,),
FittedBox(
child: DataTable(
border: TableBorder.all(
width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5)),
color: Colors.grey,), columns: [
DataColumn(
label: Text(
"${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
)),
DataColumn(
label: Text(
"${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
)),], rows: [
...rate.map((e) => DataRow(cells: [
DataCell(Text(
"${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")),
DataCell(Text("${e.minimumCharge}"))
])).toList()
],),
color: Colors.grey,), columns: [
DataColumn(
label: Text(
"${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
)),
DataColumn(
label: Text(
"${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
)),], rows: [
...rate.map((e) => DataRow(cells: [
DataCell(Text(
"${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")),
DataCell(Text("${e.minimumCharge}"))
])).toList()
],),
),
SizedBox(height: 10,),
Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0.
],
),
SizedBox(height: 10,),
Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0.
],
),
),
actions:
actions:
(rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').length- rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered' && element.minimumCharge==0).length == 0 )
?
[TextButton(onPressed: (){
Expand Down Expand Up @@ -445,11 +447,14 @@ class BillGenerationProvider with ChangeNotifier {
}));
}
}, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.YES)}')),
TextButton(onPressed: (){
Navigator.pop(context);
}, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),]
,
));
TextButton(onPressed: (){
Navigator.pop(context);
}, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),]
,
));
}else{
Notifiers.getToastMessage(context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); //Please select billing cycle
}
} else {
autoValidation = true;
notifyListeners();
Expand Down
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
2 changes: 1 addition & 1 deletion frontend/mgramseva/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mgramseva",
"version": "1.2.18",
"version": "1.2.20",
"license": "egov"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class VendorQueryBuilder {
+ " vendor.name,eg_user.uuid as owner_uuid from eg_echallan echallan INNER JOIN eg_vendor vendor on " +
" echallan.vendor=vendor.id INNER JOIN eg_user on eg_user.uuid=vendor.owner_id where " +
" echallan.applicationstatus!='CANCELLED' and echallan.tenantid =? " +
" and echallan.taxperiodfrom >= ? order by echallan.challanno desc ";
" and echallan.createdtime >= ? order by echallan.challanno desc ";
@Autowired
private VendorConfiguration config;

Expand Down
Loading