step 27 : fix homescreen, report timestamp, filter history transaksi

This commit is contained in:
sindhu
2024-01-18 14:18:25 +07:00
parent 7986d68560
commit 60919d6d12
11 changed files with 220 additions and 184 deletions

View File

@@ -31,6 +31,10 @@ class ReportScreen extends HookConsumerWidget {
final tglAkhirTmp = useState<String>("");
String M_CompanyID = "0";
String timeStamp = DateFormat('dd-MM-yyyy').format(
DateTime.now(),
);
Future<String> getCompanyID() async {
final shared = await SharedPreferences.getInstance();
String M_CompanyID = "0";
@@ -328,8 +332,9 @@ class ReportScreen extends HookConsumerWidget {
),
onPressed: () async {
M_CompanyID = await getCompanyID();
if(M_CompanyID == "0"){
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
if (M_CompanyID == "0") {
SanckbarWidget(
context, 'Invalid Company', snackbarType.error);
return;
}
// Awal
@@ -343,13 +348,13 @@ class ReportScreen extends HookConsumerWidget {
// Akhir
DateTime parsedDateAkhir =
DateFormat('dd-MM-yyyy').parse(
ctrlTglAwal.value.text.toString(),
ctrlTglAkhir.value.text.toString(),
);
String formattedDateAkhir =
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
String url =
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=xls&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=xls&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20&tm=$timeStamp";
if (!await launchUrl(Uri.parse(url))) {
// throw Exception('Could not launch $url');
SanckbarWidget(context, 'Could not launch $url',
@@ -406,8 +411,9 @@ class ReportScreen extends HookConsumerWidget {
),
onPressed: () async {
M_CompanyID = await getCompanyID();
if(M_CompanyID == "0"){
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
if (M_CompanyID == "0") {
SanckbarWidget(
context, 'Invalid Company', snackbarType.error);
return;
}
// Awal
@@ -421,13 +427,15 @@ class ReportScreen extends HookConsumerWidget {
// Akhir
DateTime parsedDateAkhir =
DateFormat('dd-MM-yyyy').parse(
ctrlTglAwal.value.text.toString(),
ctrlTglAkhir.value.text.toString(),
);
String formattedDateAkhir =
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
String url =
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20&tm=$timeStamp";
print(url);
if (!await launchUrl(Uri.parse(url))) {
// throw Exception('Could not launch $url');
SanckbarWidget(context, 'Could not launch $url',