Beispiel #1
0
        // �Aプリントプレマックボタン押下時の処理
        private void btnPrintPremac_Click(object sender, EventArgs e)
        {
            if (dgvPremac.Rows.Count <= 0)
            {
                return;
            }

            // カレントセルの列番地を保持
            int x = dgvPremac.CurrentCellAddress.X;

            // 複数列のセル範囲に対して、Xに合致した1列のみ処理を行う
            foreach (DataGridViewCell cell in dgvPremac.SelectedCells)
            {
                if (cell.ColumnIndex == x)
                {
                    int curRow = cell.RowIndex;

                    for (int i = 0; i < dgvCopy.Columns.Count; i++)
                    {
                        if (dgvPremac[i, curRow].Value == null)
                        {
                            dgvPremac[i, curRow].Value = string.Empty;
                        }
                    }

                    string itemNo     = dgvPremac["ItemNumber", curRow].Value.ToString();
                    string itemName   = dgvPremac["ItemName", curRow].Value.ToString();
                    string supplier   = dgvPremac["SupplierName", curRow].Value.ToString();
                    string invoice    = dgvPremac["SupplierInvoice", curRow].Value.ToString();
                    string date       = dgvPremac["Delivery", curRow].Value.ToString();
                    string qty        = dgvPremac["DeliveredQTY", curRow].Value.ToString();
                    string validity   = dgvPremac["Validity", curRow].Value.ToString();
                    int    printPiece = int.Parse(cmbPiecePremac.Text);

                    if (itemNo.Trim().Length == 0 || itemName.Trim().Length == 0 ||
                        supplier.Trim().Length == 0 || invoice.Trim().Length == 0 || date.Trim().Length == 0)
                    {
                        MessageBox.Show("Please fill all of the following fields:" + Environment.NewLine
                                        + "Item Number, Item Name, Supplier Name, Supplier Invoice, Delivery Date", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    // コンボボックスで指定した枚数をプリントアウトする
                    for (int i = 0; i < printPiece; i++)
                    {
                        TfPrint.printBarCode(itemNo, itemName, supplier, invoice, date, qty, validity);
                    }
                }
            }
        }
Beispiel #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (dgvNCVH.Rows.Count <= 0)
            {
                return;
            }

            // カレントセルの列番地を保持
            int x = dgvNCVH.CurrentCellAddress.X;

            // 複数列のセル範囲に対して、Xに合致した1列のみ処理を行う
            foreach (DataGridViewCell cell in dgvNCVH.SelectedCells)
            {
                if (cell.ColumnIndex == x)
                {
                    int curRow = cell.RowIndex;

                    for (int i = 0; i < dgvNCVH.Columns.Count; i++)
                    {
                        if (dgvNCVH[i, curRow].Value == null)
                        {
                            dgvNCVH[i, curRow].Value = string.Empty;
                        }
                    }

                    string materialNo = dgvNCVH["MaterialNo", curRow].Value.ToString();
                    string lotNo      = dgvNCVH["LotNo", curRow].Value.ToString();
                    string poNo       = dgvNCVH["PONo", curRow].Value.ToString();
                    string poLine     = dgvNCVH["POLine", curRow].Value.ToString();
                    string qty        = dgvNCVH["DeliveredQTY", curRow].Value.ToString();
                    int    printPiece = int.Parse(cmbPiecePremac.Text);

                    if (materialNo.Trim().Length == 0 || lotNo.Trim().Length == 0 ||
                        poNo.Trim().Length == 0 || qty.Trim().Length == 0)
                    {
                        MessageBox.Show("Please fill all of the following fields:" + Environment.NewLine
                                        + "Material Number, Lot Number, PO Number, Delivered QTY", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    // コンボボックスで指定した枚数をプリントアウトする
                    for (int i = 0; i < printPiece; i++)
                    {
                        TfPrint.printBarCodeNCVH(materialNo, lotNo, poNo, poLine, qty);
                    }
                }
            }
        }