Пример #1
0
        public frmMainShopSimpleCheckout(frmMainShopSimple fms, DataGridView temp)
            : base("銷售作業")
        {
            this.fms  = fms;
            infolist1 = new DataGridView();
            string text = DateTime.Now.ToString("yyyyMMdd");

            string[] strWhereParameterArray = new string[1]
            {
                text
            };
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "ECRHDHS", "Hdate = {0}", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count > 0)
            {
                string text2 = dataTable.Rows.Count.ToString();
                if (text2.Length == 1)
                {
                    HseqNo = text + "00" + text2;
                }
                else if (text2.Length == 2)
                {
                    HseqNo = text + "0" + text2;
                }
                else
                {
                    HseqNo = text + text2;
                }
            }
            else
            {
                HseqNo = text + "001";
            }
            setMasterFormName("銷售作業 | 單號: " + HseqNo);
            InitializeComponent();
            for (int i = 0; i < temp.Rows.Count; i++)
            {
                infolist1.Rows.Add(temp.Rows[i].Cells[0].Value, temp.Rows[i].Cells[1].Value, temp.Rows[i].Cells[2].Value, temp.Rows[i].Cells[3].Value);
                items.Text = fms.gettotalprice();
                total.Text = fms.gettotalpriceDiscount();
            }
        }
Пример #2
0
        public printsimple(frmMainShopSimple frs, DataGridView infolist)
        {
            InitializeComponent();
            string text = DateTime.Now.ToString("yyyyMMdd HH:mm:ss");

            string[,] strFieldArray = new string[11, 2]
            {
                {
                    "sellNo",
                    frs.getHseqNo()
                },
                {
                    "sellTime",
                    text
                },
                {
                    "memberId",
                    "test"
                },
                {
                    "sum",
                    "0"
                },
                {
                    "sumDiscount",
                    "0"
                },
                {
                    "sumRebate",
                    "0"
                },
                {
                    "cash",
                    "0"
                },
                {
                    "Credit",
                    "0"
                },
                {
                    "items",
                    frs.gettotalprice()
                },
                {
                    "itemstotal",
                    frs.gettotalpriceDiscount()
                },
                {
                    "status",
                    "1"
                }
            };
            DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Insert, "", "hypos_main_sell", "", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery);
            for (int i = 0; i < infolist.Rows.Count; i++)
            {
                strFieldArray = new string[10, 2]
                {
                    {
                        "sellNo",
                        frs.getHseqNo()
                    },
                    {
                        "barcode",
                        infolist.Rows[i].Cells[3].Value.ToString()
                    },
                    {
                        "fixedPrice",
                        "0"
                    },
                    {
                        "sellingPrice",
                        "0"
                    },
                    {
                        "num",
                        infolist.Rows[i].Cells[2].Value.ToString()
                    },
                    {
                        "discount",
                        "0"
                    },
                    {
                        "subtotal",
                        "0"
                    },
                    {
                        "total",
                        "0"
                    },
                    {
                        "PRNO",
                        "test"
                    },
                    {
                        "BLNO",
                        "test2"
                    }
                };
                DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Insert, "", "hypos_detail_sell", "", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery);
            }
            MessageBox.Show("新增成功");
            Barcode barcode = new Barcode();

            barcode.IncludeLabel = true;
            barcode.LabelFont    = new Font("Verdana", 8f);
            barcode.Width        = 120;
            barcode.Height       = 60;
            Image image = barcode.Encode(TYPE.CODE128, frs.getHseqNo(), barcode.Width, barcode.Height);

            barcodeimg.Image           = image;
            label8.Text                = frs.getHseqNo();
            label9.Text                = text;
            itemsnum.Text              = frs.gettotalprice();
            totalnum.Text              = frs.gettotalpriceDiscount();
            tableLayoutPanel1.RowCount = 1;
            Label label = new Label();

            label.Text = "商品名稱";
            Label label2 = label;

            label2.Anchor = AnchorStyles.None;
            tableLayoutPanel1.Controls.Add(label2, 1, 0);
            Label label3 = new Label();

            label3.Text   = "數量";
            label2        = label3;
            label2.Anchor = AnchorStyles.None;
            tableLayoutPanel1.Controls.Add(label2, 2, 0);
            Label label4 = new Label();

            label4.Text   = "用藥範圍";
            label2        = label4;
            label2.Anchor = AnchorStyles.None;
            tableLayoutPanel1.Controls.Add(label2, 3, 0);
            for (int j = 0; j < infolist.Rows.Count; j++)
            {
                tableLayoutPanel1.RowCount += 1;
                tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100f));
                Label label5 = new Label();
                label5.Text   = infolist.Rows[j].Cells[0].Value.ToString();
                label2        = label5;
                label2.Anchor = AnchorStyles.None;
                tableLayoutPanel1.Controls.Add(label2, 0, tableLayoutPanel1.RowCount - 1);
                Label label6 = new Label();
                label6.Text   = infolist.Rows[j].Cells[1].Value.ToString();
                label2        = label6;
                label2.Anchor = AnchorStyles.None;
                tableLayoutPanel1.Controls.Add(label2, 1, tableLayoutPanel1.RowCount - 1);
                Label label7 = new Label();
                label7.Text   = infolist.Rows[j].Cells[2].Value.ToString();
                label2        = label7;
                label2.Anchor = AnchorStyles.None;
                tableLayoutPanel1.Controls.Add(label2, 2, tableLayoutPanel1.RowCount - 1);
            }
        }