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

Commit

Permalink
Pfm 4081 (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldevgarg authored Nov 29, 2023
1 parent 1626b90 commit 2497d79
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 322 deletions.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/mgramseva/lib/model/connection/water_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ class AdditionalDetails {
String? collectionPendingAmount;

@JsonKey(name: "totalamount")
double? totalAmount;
String? totalAmount;

@JsonKey(name: "appCreatedDate")
int? appCreatedDate;
num? appCreatedDate;

@JsonKey(ignore: true)
var initialMeterReadingCtrl = TextEditingController();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

325 changes: 168 additions & 157 deletions frontend/mgramseva/lib/providers/collect_payment_provider.dart

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class HouseholdRegisterProvider with ChangeNotifier {
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}',
),
TableData(
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate) : '-'}',
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate?.toInt()) : '-'}',
),
TableData(
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}',
Expand Down Expand Up @@ -570,7 +570,7 @@ class HouseholdRegisterProvider with ChangeNotifier {
'${connection.additionalDetails?.collectionAmount != null ? '₹ ${connection.additionalDetails?.collectionAmount}' : '-'}',
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-' : '-'}',
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}',
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate) : '-'}',
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate?.toInt()) : '-'}',
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}',
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}',
])
Expand Down Expand Up @@ -601,7 +601,7 @@ class HouseholdRegisterProvider with ChangeNotifier {
'${connection.additionalDetails?.collectionAmount != null ? '₹ ${connection.additionalDetails?.collectionAmount}' : '-'}',
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-' : '-'}',
'${connection.additionalDetails?.collectionPendingAmount != null ? double.parse(connection.additionalDetails?.collectionPendingAmount ?? '') < 0.0 ? '-' : '₹ ${double.parse(connection.additionalDetails?.collectionPendingAmount ?? '0').abs()}' : '-'}',
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate) : '-'}',
'${connection.additionalDetails?.appCreatedDate != null ? DateFormats.timeStampToDate(connection.additionalDetails?.appCreatedDate?.toInt()) : '-'}',
'${connection.additionalDetails?.lastDemandGeneratedDate != null && connection.additionalDetails?.lastDemandGeneratedDate != '' ? DateFormats.timeStampToDate(int.parse(connection.additionalDetails?.lastDemandGeneratedDate ?? '')) : '-'}',
'${connection.status.toString() == Constants.CONNECTION_STATUS.last ? 'Y' : 'N'}',
])
Expand Down
3 changes: 2 additions & 1 deletion frontend/mgramseva/lib/utils/printer/image_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ img.Image drawImage(img.Image dst, img.Image src,
srcY ??= 0;
srcW ??= src.width;
srcH ??= src.height;
dstW ??= (dst.width < src.width) ? dstW = dst.width : src.width;
dstW ??= (dst.width < src.width) ? dst.width : src.width;
dstH ??= (dst.height < src.height) ? dst.height : src.height;

if (blend) {
Expand All @@ -45,3 +45,4 @@ img.Image drawImage(img.Image dst, img.Image src,

return dst;
}

4 changes: 2 additions & 2 deletions frontend/mgramseva/lib/widgets/bluetooth_printer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ class _BluetoothPrinterScreenState extends State<BluetoothPrinterScreen> {
final decodedImage = img.decodeImage(imageBytes)!;
// Create a black bottom layer
// Resize the image to a 130x? thumbnail (maintaining the aspect ratio).
img.Image thumbnail = img.copyResize(decodedImage, height: decodedImage.height);
img.Image thumbnail = img.copyResize(decodedImage,width: PaperSize.mm58.width,maintainAspect: false,);
// creates a copy of the original image with set dimensions
img.Image originalImg = img.copyResize(decodedImage, width: PaperSize.mm58.width, height: decodedImage.height);
img.Image originalImg = img.copyResize(decodedImage, width: PaperSize.mm58.width,maintainAspect: false, );
// fills the original image with a white background
img.fill(originalImg, color: img.ColorRgb8(255, 255, 255));
// var padding = (originalImg.width - thumbnail.width) / 2;
Expand Down

0 comments on commit 2497d79

Please sign in to comment.