Пример #1
0
        private void wizardFromGRNToolStripButton_Click(object sender, EventArgs e)
        {
            IList addedPI = new ArrayList();

            for (int i = 0; i < itemsDataGrid.Rows.Count; i++)
            {
                GoodReceiveNoteItem pi = (GoodReceiveNoteItem)itemsDataGrid[GRNNoColumn.Index, i].Tag;
                if (pi == null)
                {
                    continue;
                }
                addedPI.Add(pi.ID);
            }
            using (SearchGRNForSuppInvoiceForm frm = new SearchGRNForSuppInvoiceForm(
                       ((Supplier)supplierkryptonComboBox.SelectedItem), addedPI, m_mainForm.CurrentUser, dateKryptonDateTimePicker.Value))
            {
                frm.ShowDialog();
                IList result = frm.RESULT;
                foreach (GoodReceiveNoteItem item in result)
                {
                    if (item.PO_ITEM.ID > 0)
                    {
                        item.PO_ITEM = r_po.FindPurchaseOrderItem(item.PO_ITEM.ID);
                    }
                    Part p   = item.PART;
                    int  row = itemsDataGrid.Rows.Add();
                    itemsDataGrid[codeColumn.Index, row].Tag    = p;
                    itemsDataGrid[GRNNoColumn.Index, row].Tag   = item;
                    itemsDataGrid[scanColumn.Index, row].Value  = p.BARCODE;
                    itemsDataGrid[GRNNoColumn.Index, row].Value = item.EVENT.CODE;
                    itemsDataGrid[codeColumn.Index, row].Value  = p.CODE;
                    itemsDataGrid[nameColumn.Index, row].Value  = p.NAME;
                    itemsDataGrid[QtyColumn.Index, row].Value   = item.OUTSTANDING_AMOUNT_TO_PR;
                    p.UNIT = (Unit)r_unit.GetById(item.UNIT);
                    itemsDataGrid[unitColumn.Index, row].Value = p.UNIT.ToString();
                    //itemsDataGrid[unitColumn.Index, row].Value = item.UNIT.ToString();
                    // if (item.UNIT.ID == item.PO_ITEM.UNIT.ID)
                    //{
                    //itemsDataGrid[priceColumn.Index, row].Value = item.PO_ITEM != null ? item.PO_ITEM.PRICE : 0d;
                    itemsDataGrid[priceColumn.Index, row].Value       = item.PO_ITEM != null ? item.PO_ITEM.PRICE_IN_SMALLEST_UNIT : 0d;
                    itemsDataGrid[discpercentColumn.Index, row].Value = item.PO_ITEM != null ? item.PO_ITEM.DISC_PERCENT : 0;
                    itemsDataGrid[discAmountColumn.Index, row].Value  = item.PO_ITEM != null ? item.PO_ITEM.DISC_AMOUNT : 0d;
                    itemsDataGrid[totalDiscColumn.Index, row].Value   = item.PO_ITEM != null ? item.PO_ITEM.TOTAL_DISCOUNT : 0d;
                    itemsDataGrid[notesColumn.Index, row].Value       = item.PO_ITEM != null ? item.PO_ITEM.NOTES : "";
                    itemsDataGrid[discabcColumn.Index, row].Value     = item.PO_ITEM != null ? item.PO_ITEM.DISC_ABC : "";
                    itemsDataGrid[totalAmountColumn.Index, row].Value = item.PO_ITEM != null ? item.PO_ITEM.SUBTOTAL : 0d;
                    itemsDataGrid[warehouseColumn.Index, row].Value   = r_warehouse.GetById(item.WAREHOUSE).ToString();
                    // }
                    updateSubtotal(row);
                }
            }
        }