private void frmEndShift_Load(object sender, EventArgs e) { userid = UserLoginModel.UserLoginInfo.StaffID; var modelShift = ShiftService.GetListShiftHistoryByUserid(userid, 0).FirstOrDefault(); if (userid == 0) { Form1 frm = new Form1(); this.Close(); frm.ShowDialog(); } else { if (modelShift != null) { MoneyFortmat Fomat = new MoneyFortmat(1); shiftid = modelShift.ShiftHistoryID; this.txtShiftName.Text = modelShift.ShiftName ?? ""; this.txtStaffName.Text = modelShift.UserName ?? ""; this.txtStartTime.Text = (modelShift.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); this.txtCashStart.Text = Fomat.getValue(modelShift.CashStart ?? 0).ToString("C"); } else { frmMessager frm = new frmMessager("Messenger", "Please create new shift. "); this.Close(); frm.ShowDialog(); } } }
public void addHistoryList(string lblName, int i) { if (i == 2) { this.btnAdd.Hide(); this.btnEnd.Hide(); var data = ShiftService.GetListShiftHistoryByUserid(userid, 1).ToList(); double totalsafe = 0; foreach (var item in data) { var ucShift = new UCShiftItem(); //ucShift.Dock = DockStyle.Fill; totalsafe = totalsafe + item.SafeDrop ?? 0; MoneyFortmat Fomat = new MoneyFortmat(1); ucShift.lblNo.Text = item.ShiftName; ucShift.lblStaff.Text = item.UserName; ucShift.lblStart.Text = (item.StartShift??DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); ucShift.lblEnd.Text = " "; if (item.EndShift != null) ucShift.lblEnd.Text = (item.EndShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); ucShift.lblCashstart.Text = Fomat.getValue(item.CashStart ?? 0).ToString("C"); ucShift.lblCashend.Text = Fomat.getValue(item.CashEnd ?? 0).ToString("C"); ucShift.lblSfaedrop.Text = Fomat.getValue(item.SafeDrop ?? 0).ToString("C"); ucShift.Size = new System.Drawing.Size(flpShiftDetail.Width-5, ucShift.Height); flpShiftDetail.Controls.Add(ucShift); } this.lblTotalSafeDrop.Text = totalsafe.ToString("C"); } else { flpShiftDetail.Controls.Clear(); } }
public void AddDataPrinter() { MoneyFortmat Fomat = new MoneyFortmat(1); DataPrinter = new List<ExportExcelToDataTable>(); var temp1 = new ExportExcelToDataTable(); temp1.Tilte = "Shift Name"; temp1.Value = modelShift.ShiftName ?? ""; DataPrinter.Add(temp1); var temp2 = new ExportExcelToDataTable(); temp2.Tilte = "Staff Name"; temp2.Value = modelShift.UserName ?? ""; DataPrinter.Add(temp2); var temp3 = new ExportExcelToDataTable(); temp3.Tilte = "Start Time"; temp3.Value = (modelShift.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); DataPrinter.Add(temp3); var temp4 = new ExportExcelToDataTable(); temp4.Tilte = "End Time"; temp4.Value = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); DataPrinter.Add(temp4); var temp5 = new ExportExcelToDataTable(); temp5.Tilte = "Cash Start"; temp5.Value = Fomat.getValue(modelShift.CashStart ?? 0).ToString("C"); DataPrinter.Add(temp5); var temp6 = new ExportExcelToDataTable(); temp6.Tilte = "Cash End"; temp6.Value = Fomat.getValue(modelShift.CashEnd ?? 0).ToString("C"); DataPrinter.Add(temp6); var temp7 = new ExportExcelToDataTable(); temp7.Tilte = "Safe Drop"; temp7.Value = Fomat.getValue(modelShift.SafeDrop ?? 0).ToString("C"); DataPrinter.Add(temp7); }
public void addOnDutyList(string lblName, int i) { try { flpShiftDetail.Controls.Clear(); if (i == 1) { this.btnAdd.Show(); this.btnEnd.Show(); var data = ShiftService.GetListShiftHistoryByUserid(userid, 0).ToList(); double totalsafe = 0; foreach (var item in data) { var ucShift = new UCShiftItem(); //ucShift.Dock = DockStyle.Fill; MoneyFortmat Fomat = new MoneyFortmat(1); totalsafe = totalsafe + item.SafeDrop ?? 0; ucShift.lblNo.Text = item.ShiftName; ucShift.lblStaff.Text = item.UserName; ucShift.lblStart.Text = (item.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); ucShift.lblEnd.Text = " "; if (item.EndShift != null) ucShift.lblEnd.Text = (item.EndShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); ucShift.lblCashstart.Text = Fomat.getValue(item.CashStart ?? 0).ToString("C"); ucShift.lblCashend.Text = Fomat.getValue(item.CashEnd ?? 0).ToString("C"); ucShift.lblSfaedrop.Text = Fomat.getValue(item.SafeDrop ?? 0).ToString("C"); ucShift.Size = new System.Drawing.Size(flpShiftDetail.Width - 5, ucShift.Height); ucShift.Tag = item; ucShift.Click += UCShiftItem_Click; ucShift.Width = flpShiftDetail.Width; flpShiftDetail.Controls.Add(ucShift); } this.lblTotalSafeDrop.Text = totalsafe.ToString("C"); } else { flpShiftDetail.Controls.Clear(); } } catch (Exception ex) { SystemLog.LogPOS.WriteLog("frmShift::::::::::::::::addOnDutyList:::::::::::::" + ex.Message); } }
private void frmEndShift_Load(object sender, EventArgs e) { userid = UserLoginModel.UserLoginInfo.StaffID; if (userid == 0) { Form1 frm = new Form1(); this.Close(); frm.ShowDialog(); } else { if (modelShift != null) { MoneyFortmat Fomat = new MoneyFortmat(1); this.txtShiftName.Text = modelShift.ShiftName ?? ""; this.txtStaffName.Text = modelShift.UserName ?? ""; this.txtStartTime.Text = (modelShift.StartShift ?? DateTime.Now).ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); this.txtEndTime.Text = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss", CultureInfo.InvariantCulture); this.txtCashStart.Text = Fomat.getValue(modelShift.CashStart ?? 0).ToString("C"); this.txtCashEnd.Text = Fomat.getValue(modelShift.CashEnd ?? 0).ToString("C"); this.txtSafeDrop.Text = Fomat.getValue(modelShift.SafeDrop ?? 0).ToString("C"); } } }
private void btnSubmit_Click(object sender, EventArgs e) { modelShift.UpdateBy = userid; modelShift.UpdateDate = DateTime.Now; modelShift.EndShift = DateTime.Now; var cashEnd = this.txtCashEnd.Text.Replace("$", ""); modelShift.CashEnd = double.Parse(cashEnd); MoneyFortmat Fomat = new MoneyFortmat(1); modelShift.CashEnd = Fomat.getFortMat(modelShift.CashEnd??0); var safeDrop = this.txtSafeDrop.Text.Replace("$", ""); modelShift.SafeDrop = double.Parse(safeDrop); modelShift.SafeDrop = Fomat.getFortMat(modelShift.SafeDrop ?? 0); if (modelShift.CashEnd < modelShift.CashStart) { frmMessager frm = new frmMessager("Messenger", "Cash end isn't less than cash start. "); frmOpacity.ShowDialog(this, frm); } else { var result = ShiftService.UpdateDataShiftHistory(modelShift); var messenger = "Save data end shift fail."; if (result > 0) { AddDataPrinter(); GetListPrinter(); foreach (PrinterModel item in PrintData) { Header = item.Header; posPrinter.SetPrinterName(item.PrinterName); posPrinter.printDocument.PrintPage += printDocument_PrintPage; posPrinter.Print(); } UserLoginModel.ShiffID = 0; messenger = "Save data end shift successful."; this.DialogResult = System.Windows.Forms.DialogResult.OK; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } }
private void LoadShiftReportDetail(ShiftReportModel data) { if (data != null) { pDetail.Controls.Clear(); UCShiftReport shift = new UCShiftReport(); shift.Dock = DockStyle.Fill; var fomat = new MoneyFortmat(1); shift.lblShiftNo.Text = data.ShiftName ?? ""; shift.lblStaff.Text = data.UserName ?? ""; shift.lblStartTime.Text = (data.StartShift ?? DateTime.Now).ToString("dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture); shift.lblEndTime.Text = (data.EndShift ?? DateTime.Now).ToString("dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture); shift.lblStartCash.Text = "$" + fomat.getValue(data.CashStart).ToString("N2"); shift.lblEndCash.Text = "$" + fomat.getValue(data.CashEnd).ToString("N2"); shift.lblSafeDrop.Text = "$" + fomat.getValue(data.SafeDrop).ToString("N2"); shift.lblTotal.Text = "$" + fomat.getValue(data.TotalCash).ToString("N2"); shift.lblVariation.Text = "$" + fomat.getValue(data.CashEnd - data.CashStart - data.TotalCash).ToString("N2"); shift.lblTotalNetSalse.Text = "$" + fomat.getValue(data.TotalSale).ToString("N2"); var export = new List<ExportExcelToDataTable>(); var temp1 = new ExportExcelToDataTable(); temp1.Tilte = "Shift No"; temp1.Value = data.ShiftName ?? ""; export.Add(temp1); var temp2 = new ExportExcelToDataTable(); temp2.Tilte = "Staff"; temp2.Value = data.UserName ?? ""; export.Add(temp2); var temp3 = new ExportExcelToDataTable(); temp3.Tilte = "Start Time"; temp3.Value = (data.StartShift ?? DateTime.Now).ToString("dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture); export.Add(temp3); var temp4 = new ExportExcelToDataTable(); temp4.Tilte = "End Time"; temp4.Value = (data.EndShift ?? DateTime.Now).ToString("dd/MM/yyyy hh:mm:ss", CultureInfo.InvariantCulture); export.Add(temp4); var temp5 = new ExportExcelToDataTable(); temp5.Tilte = "Start Cash(Cash float in)"; temp5.Value = fomat.getValue(data.CashStart).ToString("N2"); export.Add(temp5); var temp6 = new ExportExcelToDataTable(); temp6.Tilte = "End Cash(Counted by Staff)"; temp6.Value = fomat.getValue(data.CashEnd).ToString("N2"); export.Add(temp6); var temp7 = new ExportExcelToDataTable(); temp7.Tilte = "Total Cash by Report"; temp7.Value = fomat.getValue(data.TotalCash).ToString("N2"); export.Add(temp7); var temp8 = new ExportExcelToDataTable(); temp8.Tilte = "Variation"; temp8.Value = fomat.getValue(data.CashEnd - data.CashStart - data.TotalCash).ToString("N2"); export.Add(temp8); var temp9 = new ExportExcelToDataTable(); temp9.Tilte = "Safe drop"; temp9.Value = fomat.getValue(data.SafeDrop).ToString("N2"); export.Add(temp9); var temp10 = new ExportExcelToDataTable(); temp10.Tilte = "Total Net Sale by Shift"; temp10.Value = fomat.getValue(data.TotalSale).ToString("N2"); export.Add(temp10); shift.btnExport.Tag = export; shift.btnExport.Click += ExportExcel_Click; shift.btnPrint.Tag = export; shift.btnPrint.Click += PrinterClick_Click; pDetail.Controls.Add(shift); } }
private void LoadReportWeeklySaleByStaffDetail() { pDetail.Controls.Clear(); UCDailySaleQTYReport UCQTYReport = new UCDailySaleQTYReport(); UCQTYReport.Dock = DockStyle.Fill; pDetail.Controls.Add(UCQTYReport); var dateselect = Convert.ToDateTime(dateSelect.Text).ToString("yyyy-MM-dd"); var data = ReportService.GetDataStaffSaleReport(dateselect, 1).ToList(); var export = new List<ExportExcelToDataTable>(); var i = 1; foreach (var item in data) { UCItemReport ucitem = new UCItemReport(); ucitem.lbname.Text = item.UserName; var fomat = new MoneyFortmat(1); ucitem.lbtotal.Text = fomat.getValue(item.Total).ToString("C"); var temp = new ExportExcelToDataTable(); temp.Tilte = item.UserName; temp.Value = fomat.getValue(item.Total).ToString("N2"); export.Add(temp); ucitem.Size = new System.Drawing.Size(UCQTYReport.PDetail.Width - 5, ucitem.Height); if (i % 2 == 0) { ucitem.BackColor = Color.FromArgb(221, 221, 221); } UCQTYReport.PDetail.Controls.Add(ucitem); i++; } UCQTYReport.btnExport.Tag = export; UCQTYReport.btnExport.Click += ExportExcel_Click; UCQTYReport.btnPrint.Tag = export; UCQTYReport.btnPrint.Click += PrinterClick_Click; }
public void SetDataSummary(UCDailySaleSumaryReport ucDailyReport, DailyReportModel data) { var fomat = new MoneyFortmat(1); ucDailyReport.lblNetSalse.Text = fomat.getValue(data.NetSale).ToString("C"); ucDailyReport.lblGST.Text = fomat.getValue(data.GST).ToString("C"); ucDailyReport.lblDiscount.Text = fomat.getValue(data.Discount).ToString("C"); ucDailyReport.lblRefund.Text = fomat.getValue(data.Refund).ToString("C"); ucDailyReport.lblTotakReceiva.Text = "$" + fomat.getValue(data.NetSale + data.GST - data.Discount).ToString("N2"); ucDailyReport.lblTotakCash.Text = "$" + fomat.getValue(data.CashTotal).ToString("N2"); ucDailyReport.lblTotalCard.Text = fomat.getValue(data.CardTotal).ToString("C"); ucDailyReport.lblTotalAccount.Text = fomat.getValue(data.AccountTotal).ToString("C"); var export = new List<ExportExcelToDataTable>(); var temp1 = new ExportExcelToDataTable(); temp1.Tilte = "Net Sale"; temp1.Value = fomat.getValue(data.NetSale).ToString("N2"); export.Add(temp1); var temp2 = new ExportExcelToDataTable(); temp2.Tilte = "GST"; temp2.Value = fomat.getValue(data.GST).ToString("N2"); export.Add(temp2); var temp3 = new ExportExcelToDataTable(); temp3.Tilte = "Discount"; temp3.Value = fomat.getValue(data.Discount).ToString("N2"); export.Add(temp3); var temp4 = new ExportExcelToDataTable(); temp4.Tilte = "Refund"; temp4.Value = fomat.getValue(data.Refund).ToString("N2"); export.Add(temp4); var temp5 = new ExportExcelToDataTable(); temp5.Tilte = "Total Receivable"; temp5.Value = fomat.getValue(data.NetSale + data.GST - data.Discount).ToString("N2"); export.Add(temp5); var temp6 = new ExportExcelToDataTable(); temp6.Tilte = "Total CASH"; temp6.Value = fomat.getValue(data.CashTotal).ToString("N2"); export.Add(temp6); var temp7 = new ExportExcelToDataTable(); temp7.Tilte = "Total CARD"; temp7.Value = fomat.getValue(data.CardTotal).ToString("N2"); export.Add(temp7); var temp8 = new ExportExcelToDataTable(); temp8.Tilte = "Total ACCOUNT"; temp8.Value = fomat.getValue(data.AccountTotal).ToString("N2"); export.Add(temp8); ucDailyReport.btnExport.Tag = export; ucDailyReport.btnExport.Click += ExportExcel_Click; ucDailyReport.btnPrint.Tag = export; ucDailyReport.btnPrint.Click += PrinterClick_Click; }