Untitled
unknown
plain_text
2 years ago
3.1 kB
5
Indexable
Future<void> pushAllTranscations() async {
List<PosOrder> posOrders = await dbPosOrder.fetchValidateOrder();
List<PosSession> posSesions = await dbPosOrder.fetchValidateShift();
int length = posOrders.length;
List<Map> finalMapList = [];
List<Map> finalMapListShift = [];
int lengthsession = posSesions.length;
print('lengthsession44 ${lengthsession}');
for (int i = 0; i < lengthsession; i++) {
Map newMapShift = {
'id' : posSesions[i].id,
'warehouse_id' : posSesions[i].cashierId,
'cashier_id' : posSesions[i].cashierId,
'shift_id' : posSesions[i].cashierId,
'shiftin' : posSesions[i].cashierId,
'shiftout' : posSesions[i].cashierId,
'amtmodal' : posSesions[i].cashierId,
'amtsetor' : posSesions[i].cashierId,
'amtshift' : posSesions[i].cashierId,
'created_at' : posSesions[i].cashierId,
'updated_at' : posSesions[i].cashierId,
'created_by' : posSesions[i].cashierId,
'updated_by' : posSesions[i].cashierId,
};
finalMapListShift.add(newMapShift);
}
for (int i = 0; i < length; i++) {
Map newMap = {
'id': posOrders[i].id,
'documentno': posOrders[i].documentNo,
'ranno': posOrders[i].ranNo,
'dateordered': posOrders[i].createdAt.toString(),
'bonmanual': '',
'description': posOrders[i].customerId,
'trxtime': posOrders[i].createdAt.toString(),
'syncedbi': 'N',
'syncdadem': 'N',
'warehouse_id':
(systemParameterCubit.state as SystemParameterConfigured)
.warehouseData
.id
.toString(),
'cashier_id':
(accountCubit.state as UserAccountAttached).accountData.nik,
'customer_id': posOrders[i].getCustomerName(),
'gro_id': posOrders[i].groId,
'guide_id': posOrders[i].guideId,
'created_at': posOrders[i].createdAt.toString(),
'updated_at': posOrders[i].createdAt.toString(),
'created_by':
(accountCubit.state as UserAccountAttached).accountData.nik,
'updated_by':
(accountCubit.state as UserAccountAttached).accountData.nik,
'kondisi_pos': 'order',
'data_m_pospayment': await getPaymentMap(order: posOrders[i]),
'data_mposline': await getOrderLinesMap(order: posOrders[i]),
};
finalMapList.add(newMap);
}
Map<String, dynamic> result = {
'datashift': finalMapListShift,
'data': finalMapList,
};
Map<String, dynamic> resultaja = await apiPos.pushAllTranscaction(
map: result,
companyType: (systemParameterCubit.state as SystemParameterConfigured)
.companyType,
);
print('tes aja $resultaja');
//========================
if (resultaja['status'] == 200) {
add(const SpaDashboardEventPushCheckInDated());
deletePushTransaction();
} else {
add(const SpaDashboardEventPushCheckOutDated());
}
print('apiPos555 ${apiPos.pushAllTranscaction}');
}
Editor is loading...
Leave a Comment