step 15 : remove padding report

This commit is contained in:
sindhu
2024-01-16 09:03:44 +07:00
parent 088c18f536
commit a317946fc2
7 changed files with 234 additions and 147 deletions

View File

@@ -15,6 +15,9 @@ class Constant {
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
// tester devbandungraya
static String baseUrlDevoneReport =
"devone.aplikasi.web.id";
static String baseUrlDevone =
"http://devone.aplikasi.web.id/one-api-pettycash/pettycash/";

View File

@@ -25,8 +25,8 @@ class AuthDoctorModel {
late String M_UserID;
late String M_UserUsername;
late String M_UserEmail;
// late String M_UserM_DoctorCode;
// late String M_UserM_DoctorID;
late String M_CompanyID;
late String M_CompanyName;
// late String M_UserM_StaffID;
// late String M_UserM_MouID;
late String ip;
@@ -39,8 +39,8 @@ class AuthDoctorModel {
required this.M_UserID,
required this.M_UserUsername,
required this.M_UserEmail,
// required this.M_UserM_DoctorCode,
// required this.M_UserM_DoctorID,
required this.M_CompanyID,
required this.M_CompanyName,
// this.M_UserM_StaffID = "",
// this.M_UserM_MouID = "",
this.ip = "",
@@ -51,8 +51,8 @@ class AuthDoctorModel {
M_UserID = json['M_UserID'].toString();
M_UserUsername = json['M_UserUsername'].toString();
M_UserEmail = json['M_UserEmail'].toString();
// M_UserM_DoctorCode = json['M_UserM_DoctorCode'].toString();
// M_UserM_DoctorID = json['M_UserM_DoctorID'].toString();
M_CompanyID = json['M_CompanyID'].toString();
M_CompanyName = json['M_CompanyName'].toString();
// M_UserM_StaffID = json['M_UserM_StaffID'].toString();
// M_UserM_MouID = json['M_UserM_MouID'].toString();
ip = json['ip'].toString();
@@ -64,8 +64,8 @@ class AuthDoctorModel {
data['M_UserID'] = M_UserID;
data['M_UserUsername'] = M_UserUsername;
data['M_UserEmail'] = M_UserEmail;
// data['M_UserM_DoctorCode'] = M_UserM_DoctorCode;
// data['M_UserM_DoctorID'] = M_UserM_DoctorID;
data['M_CompanyID'] = M_CompanyID;
data['M_CompanyName'] = M_CompanyName;
// data['M_UserM_StaffID'] = M_UserM_StaffID;
// data['M_UserM_MouID'] = M_UserM_MouID;
data['ip'] = ip;

View File

@@ -58,12 +58,12 @@ class TransaksiRepository extends BaseRepository {
String sender,
String url) async {
String paramPostInUrl = "";
if (tipe == "KREDIT") {
if (tipe == "DEBIT") {
sender = "";
paramPostInUrl =
"?tanggal=$tanggal&tipe=$tipe&kategoriid=$kategoriid&jumlah=$jumlah&catatan=$catatan&url=$url&userid=$userid&sender=$sender";
} else {
if (tipe == "DEBIT") {
if (tipe == "KREDIT") {
kategoriid = "0";
paramPostInUrl =
"?tanggal=$tanggal&tipe=$tipe&kategoriid=$kategoriid&jumlah=$jumlah&catatan=$catatan&url=$url&userid=$userid&sender=$sender";

View File

@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import '../../app/constant.dart';
import '../../widget/custom_drawer.dart';
class ChangeCompanyScreen extends StatelessWidget {
const ChangeCompanyScreen({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(
top: Constant.getActualYPhone(context: context, y: 30),
),
child: Scaffold(
appBar: AppBar(
// centerTitle: true,
title: Text(
'Change Company',
style: TextStyle(color: Constant.textWhite),
),
backgroundColor: Constant.pcBtnBackgroundColor,
iconTheme: IconThemeData(
color: Constant.textWhite,
),
),
drawer: CustomDrawer(),
),
);
}
}

View File

@@ -29,7 +29,8 @@ class LoginScreen extends HookConsumerWidget {
final authModel = AuthModel(
token: xmodel["token"],
model: AuthDoctorModel(
// M_UserM_DoctorID: xmodel["model"]["M_UserM_DoctorID"],
M_CompanyID: xmodel["model"]["M_CompanyID"],
M_CompanyName: xmodel["model"]["M_CompanyName"],
M_UserEmail: xmodel["model"]["M_UserEmail"],
M_UserUsername: xmodel["model"]["M_UserUsername"],
// M_UserM_DoctorCode: xmodel["model"]["M_UserM_DoctorCode"],

View File

@@ -254,150 +254,161 @@ class ReportScreen extends HookConsumerWidget {
),
),
),
bottomNavigationBar: Padding(
padding: EdgeInsets.only(
// right: Constant.getActualXPhone(context: context, x: 27),
// left: Constant.getActualXPhone(context: context, x: 27),
// bottom: Constant.getActualYPhone(context: context, y: 32),
top: Constant.getActualYPhone(context: context, y: 10),
),
child: BottomAppBar(
child: Container(
height: 150,
child: Padding(
padding: EdgeInsets.only(
// right: Constant.getActualXPhone(context: context, x: 27),
// left: Constant.getActualXPhone(context: context, x: 27),
// bottom: Constant.getActualYPhone(context: context, y: 32),
top: Constant.getActualYPhone(context: context, y: 24),
),
child: Column(
children: [
// Excel
Container(
width: Constant.getActualXPhone(context: context, x: 336),
height: Constant.getActualYPhone(context: context, y: 42),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith(
(states) => Colors.white),
// side: MaterialStateBorderSide.resolveWith(
// (states) => BorderSide(color: Colors.green),
// ),
bottomNavigationBar: Container(
// height: 150,
child: Padding(
padding: EdgeInsets.only(
// right: Constant.getActualXPhone(context: context, x: 27),
// left: Constant.getActualXPhone(context: context, x: 27),
// bottom: Constant.getActualYPhone(context: context, y: 32),
top: Constant.getActualYPhone(context: context, y: 24),
),
child: Column(
children: [
// Excel
Container(
width: Constant.getActualXPhone(context: context, x: 336),
height: Constant.getActualYPhone(context: context, y: 42),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith(
(states) => Colors.white),
// side: MaterialStateBorderSide.resolveWith(
// (states) => BorderSide(color: Colors.green),
// ),
// backgroundColor: MaterialStateColor.resolveWith(
// (st) => Constant.pcBtnBackgroundColor),
shape:
MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.green,
),
),
// backgroundColor: MaterialStateColor.resolveWith(
// (st) => Constant.pcBtnBackgroundColor),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.green,
),
shadowColor:
MaterialStateProperty.all(Color(0xffff48423d)),
elevation: MaterialStateProperty.all(4.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: Constant.getActualXPhone(
context: context, x: 16),
height: Constant.getActualYPhone(
context: context, y: 16),
// decoration: BoxDecoration(color: Colors.grey),
child: Image.asset(
"images/logo_excel.png",
fit: BoxFit.fill,
// scale: 1,
),
),
SizedBox(
height: Constant.getActualXPhone(
context: context, x: 8),
),
Text(
'Download Report (xls) ',
style: Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Colors.green,
),
),
],
),
onPressed: () {},
),
shadowColor:
MaterialStateProperty.all(Color(0xffff48423d)),
elevation: MaterialStateProperty.all(4.0),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 20),
),
// PDF
Container(
width: Constant.getActualXPhone(context: context, x: 336),
height: Constant.getActualYPhone(context: context, y: 42),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith(
(st) => Constant.pcBtnBackgroundColor),
shape:
MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Constant.pcBtnBackgroundColor,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width:
Constant.getActualXPhone(context: context, x: 16),
height:
Constant.getActualYPhone(context: context, y: 16),
// decoration: BoxDecoration(color: Colors.grey),
child: Image.asset(
"images/logo_excel.png",
fit: BoxFit.fill,
// scale: 1,
),
shadowColor:
MaterialStateProperty.all(Color(0xffff48423d)),
elevation: MaterialStateProperty.all(4.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: Constant.getActualXPhone(
context: context, x: 16),
height: Constant.getActualYPhone(
context: context, y: 16),
// decoration: BoxDecoration(color: Colors.grey),
child: Image.asset(
"images/logo_pdf.png",
fit: BoxFit.fill,
// scale: 1,
),
),
SizedBox(
height: Constant.getActualXPhone(
context: context, x: 8),
),
Text(
'Download Report (PDF)',
style: Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Constant.white),
),
],
SizedBox(
height:
Constant.getActualXPhone(context: context, x: 8),
),
onPressed: () async {
String url =
"https://pub.dev/packages?q=url+launcher";
if (!await launchUrl(Uri.parse(url))) {
// throw Exception('Could not launch $url');
SanckbarWidget(context, 'Could not launch $url',
snackbarType.error);
}
},
),
Text(
'Download Report (xls) ',
style: Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Colors.green,
),
),
],
),
],
onPressed: () async {
// Awal
DateTime parsedDateAwal = DateFormat('dd-MM-yyyy').parse(
ctrlTglAwal.value.text.toString(),
);
String formattedDateAwal =
DateFormat('yyyy-MM-dd').format(parsedDateAwal);
// Akhir
DateTime parsedDateAkhir = DateFormat('dd-MM-yyyy').parse(
ctrlTglAwal.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=0&username=adminsas%20";
if (!await launchUrl(Uri.parse(url))) {
// throw Exception('Could not launch $url');
SanckbarWidget(context, 'Could not launch $url',
snackbarType.error);
}
// https://devone.aplikasi.web.id/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=2023-11-01&PEndDate=2023-12-30&PCompanyID=0&username=adminsas%20&tm=1701327096267
},
),
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 20),
),
// PDF
Container(
width: Constant.getActualXPhone(context: context, x: 336),
height: Constant.getActualYPhone(context: context, y: 42),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith(
(st) => Constant.pcBtnBackgroundColor),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Constant.pcBtnBackgroundColor,
),
),
),
shadowColor:
MaterialStateProperty.all(Color(0xffff48423d)),
elevation: MaterialStateProperty.all(4.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width:
Constant.getActualXPhone(context: context, x: 16),
height:
Constant.getActualYPhone(context: context, y: 16),
// decoration: BoxDecoration(color: Colors.grey),
child: Image.asset(
"images/logo_pdf.png",
fit: BoxFit.fill,
// scale: 1,
),
),
SizedBox(
height:
Constant.getActualXPhone(context: context, x: 8),
),
Text(
'Download Report (PDF)',
style: Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Constant.white),
),
],
),
onPressed: () async {
// String url =
// "https://pub.dev/packages?q=url+launcher";
// if (!await launchUrl(Uri.parse(url))) {
// // throw Exception('Could not launch $url');
// SanckbarWidget(context, 'Could not launch $url',
// snackbarType.error);
// }
},
),
),
],
),
),
),

View File

@@ -43,6 +43,7 @@ class TransaksiScreen extends HookConsumerWidget {
final ctrlJumlah = useTextEditingController(text: "");
final ctrlCatatan = useTextEditingController(text: "");
final ctrlNamaPengirim = useTextEditingController(text: "");
final ctrlCompanyName = useTextEditingController(text: "");
String formattedDate = DateFormat('dd-MM-yyyy').format(DateTime.now());
@@ -202,6 +203,46 @@ class TransaksiScreen extends HookConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Company Name
Text(
'Company Name',
style: Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600, color: Constant.textBlack),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 10),
),
TextField(
controller: ctrlCompanyName,
readOnly: true,
decoration: InputDecoration(
hintStyle:
Constant.body2_400(context: context).copyWith(
color: Constant.textGreyv2,
),
labelStyle:
Constant.body2_400(context: context).copyWith(
color: Constant.textGreyv2,
),
border: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.orange,
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Constant.textGreyv2,
width: 1,
),
),
labelText: "Company Name",
hintText: 'Company Name',
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 20),
),
Text(
'Tanggal Transaksi',
style: Constant.body1(context: context).copyWith(
@@ -714,12 +755,12 @@ class TransaksiScreen extends HookConsumerWidget {
),
onPressed: () {
if (selectedListTypeData.value.typeid.toString() ==
"KREDIT") {
"DEBIT") {
ctrlNamaPengirim.text = "";
// validasi form
} else {
if (selectedListTypeData.value.typeid.toString() ==
"DEBIT") {
"KREDIT") {
selectedListCategory.value.categoryid = "0";
// validasi form
}