public MainForm() { InitializeComponent(); new Database().CreateTable(); FormBorderStyle = FormBorderStyle.FixedSingle; MinimizeBox = false; MaximizeBox = false; PosInformation.GetInstance().Init(this); }
private void OnReadStaff(string barcode) { var staff = new Database().SelectSingle <StaffObject>($"WHERE barcode = '{barcode}'"); if (staff != null) { reg_user.Text = staff.Name; PosInformation.GetInstance().SetStaff(staff); } else { var staffRegist = new StaffRegistWindow(barcode); staffRegist.ShowDialog(this); staffRegist.Dispose(); } }
private void Staff_Regist_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && textBox1.Text != "") { var result = MessageBox.Show(@"このなまえでとうろくしますか?" + Environment.NewLine + textBox1.Text, @"読み込みエラー", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { StaffObject staff = new StaffObject(_barcode, textBox1.Text); SocketClient.GetInstance().RegistUser(staff); PosInformation.GetInstance().SetStaff(staff); Close(); } } else if (e.KeyCode == Keys.Escape) { Close(); } }
public AccountChange(string recMoney, ListView recPoints, string recItems) { InitializeComponent(); MaximizeBox = !MaximizeBox; MinimizeBox = !MinimizeBox; FormBorderStyle = FormBorderStyle.FixedSingle; reg_goods_sum.Text = Form1.RegItemPriceSum.ToString(); received_money.Text = recMoney; change.Text = (int.Parse(received_money.Text) - int.Parse(reg_goods_sum.Text)).ToString(); _itemList = recPoints; _sale = new SaleObject( recPoints.Items.Count, Form1.RegItemPriceSum, recItems, Config.GetInstance().Store.Id, PosInformation.GetInstance().GetStaffBarcode()); new Database().Insert(_sale); }
private static string CreateStaffBarcode(int staffId) { return ($"{BarcodeConfig.Prefix}{BarcodeConfig.Staff}{PosInformation.GetInstance().Year}{staffId:D4}"); }
public void Init() { new Database().CreateTable(); PosInformation.GetInstance().Init(this); new Csv().LoadConfig(); }
public void PrintReceipt(ListView itemList, string deposit, PrintPageEventArgs e, string accountCode) { var marginMin = 3; var marginMax = 70; var alignCenter = 27; var lineHeight = 7; var drawHeightPosition = 0; var graphics = e.Graphics; graphics.PageUnit = GraphicsUnit.Millimeter; var font = new Font("MS UI Gothic", 10); var fontBig = new Font("MS UI Gothic", 13); graphics.DrawImage(Image.FromFile(@"Kids.jpg"), 3, 3, 67, 20); drawHeightPosition += lineHeight + 22; DrawString(graphics, fontBig, "<レシート>", alignCenter, drawHeightPosition); drawHeightPosition += lineHeight + 3; DrawString(graphics, font, DateTime.Now.ToString("yyyy年MM月dd日 HH時mm分ss秒"), marginMin, drawHeightPosition); drawHeightPosition += lineHeight; graphics.DrawLine(new Pen(Brushes.Black), new Point(marginMin, drawHeightPosition), new Point(marginMax, drawHeightPosition)); drawHeightPosition += lineHeight; for (var i = 0; i < itemList.Items.Count; i++) { var lvi = itemList.Items[i]; DrawString(graphics, fontBig, lvi.SubItems[0].Text + " " + lvi.SubItems[1].Text, marginMin, drawHeightPosition); DrawString(graphics, fontBig, "\t\t\\" + lvi.SubItems[3].Text, marginMin + 15, drawHeightPosition); drawHeightPosition += lineHeight; } graphics.DrawLine(new Pen(Brushes.Black), new Point(marginMin, drawHeightPosition), new Point(marginMax, drawHeightPosition)); drawHeightPosition += lineHeight; var sum = 0; foreach (ListViewItem v in itemList.Items) { sum += int.Parse(v.SubItems[3].Text); } DrawString(graphics, fontBig, "ごうけい", marginMin, drawHeightPosition); DrawString(graphics, fontBig, "\t\t\\" + sum, marginMin + 15, drawHeightPosition); drawHeightPosition += lineHeight; DrawString(graphics, fontBig, "おあずかり", marginMin, drawHeightPosition); DrawString(graphics, fontBig, "\t\t\\" + deposit, marginMin + 15, drawHeightPosition); drawHeightPosition += lineHeight; DrawString(graphics, fontBig, "おつり", marginMin, drawHeightPosition); DrawString(graphics, fontBig, "\t\t\\" + (int.Parse(deposit) - sum), marginMin + 15, drawHeightPosition); drawHeightPosition += lineHeight; drawHeightPosition += lineHeight; DrawString(graphics, fontBig, "おみせ: " + Config.GetInstance().Store.Name, marginMin, drawHeightPosition); drawHeightPosition += lineHeight; DrawString(graphics, fontBig, "れじのたんとう: " + PosInformation.GetInstance().GetStaffName(), marginMin, drawHeightPosition); drawHeightPosition += lineHeight + 5; DrawString(graphics, fontBig, "印字保護のためこちらの面を" + Environment.NewLine + "内側に折って保管してください", marginMin + 3, drawHeightPosition); drawHeightPosition += lineHeight; drawHeightPosition += lineHeight; var barcode = new BarcodeObject(accountCode).GetBitmap(); graphics.DrawImage(barcode, alignCenter - 13, drawHeightPosition, barcode.Width * 0.34f, barcode.Height * 0.14f); drawHeightPosition += lineHeight + 10; graphics.DrawLine(new Pen(Brushes.Black), new Point(marginMin, drawHeightPosition), new Point(marginMax, drawHeightPosition)); e.HasMorePages = false; }