private void ShowOrderItemState()
        {
            if (UpdatingItem != null)
            {
                List <string> sheets = new List <string>();
                sheets.Add((UpdatingItem as PurchaseOrder).ID);
                PurchaseItemRecordSearchCondition con = new PurchaseItemRecordSearchCondition();
                con.SheetNo = sheets;
                List <PurchaseItemRecord> states = (new PurchaseOrderBLL(AppSettings.Current.ConnStr)).GetRecords(con).QueryObjects;
                if (states != null && states.Count > 0)
                {
                    foreach (DataGridViewRow row in ItemsGrid.Rows)
                    {
                        PurchaseItem oi = row.Tag as PurchaseItem;
                        if (oi != null)
                        {
                            PurchaseItemRecord st = states.SingleOrDefault(item => item.ID == oi.ID);
                            row.Cells["colReceived"].Value = st != null?st.Received.Trim().ToString() : null;

                            //row.Cells["colOnway"].Value = st != null ? st.OnWay.Trim().ToString() : null;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected override void ShowItemInGridViewRow(DataGridViewRow row, object item)
        {
            PurchaseItemRecord info = item as PurchaseItemRecord;

            row.Tag = info;
            row.Cells["colSheetNo"].Value       = info.SheetNo;
            row.Cells["colSupplier"].Value      = info.Supplier != null ? info.Supplier.Name : string.Empty;
            row.Cells["colProduct"].Value       = info.Product != null? info.Product.Name:string.Empty;
            row.Cells["colSpecification"].Value = info.Product.Specification;
            row.Cells["colUnit"].Value          = info.Unit;
            row.Cells["colCount"].Value         = info.Count.Trim();
            row.Cells["colReceived"].Value      = info.Received.Trim();
            row.Cells["colOnway"].Value         = info.OnWay.Trim();
            row.Cells["colDemandDate"].Value    = info.DemandDate.ToLongDateString();
            row.Cells["colOrderID"].Value       = info.OrderID;
            row.Cells["colBuyer"].Value         = info.Buyer;
            row.Cells["colMemo"].Value          = info.Memo;
            if (info.State == SheetState.Canceled)
            {
                row.DefaultCellStyle.ForeColor = Color.Red;
                row.DefaultCellStyle.Font      = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            }
            if (!_Records.Exists(it => it.ID == info.ID))
            {
                _Records.Add(info);
            }
        }
Ejemplo n.º 3
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         PurchaseItemRecord record = dataGridView1.Rows[e.RowIndex].Tag as PurchaseItemRecord;
         if (dataGridView1.Columns[e.ColumnIndex].Name == "colSheetNo")
         {
             PurchaseOrder sheet = (new PurchaseOrderBLL(AppSettings.Current.ConnStr)).GetByID(record.SheetNo).QueryObject;
             if (sheet != null)
             {
                 FrmPurchaseOrderDetail frm = new FrmPurchaseOrderDetail();
                 frm.IsAdding     = false;
                 frm.UpdatingItem = sheet;
                 frm.IsForView    = true;
                 frm.ShowDialog();
             }
         }
         else if (dataGridView1.Columns[e.ColumnIndex].Name == "colReceived")
         {
             ProductInventoryItemSearchCondition con = new ProductInventoryItemSearchCondition();
             con.PurchaseItem = record.ID;
             FrmProductInventoryItemView frm = new FrmProductInventoryItemView();
             frm.SearchCondition = con;
             frm.ShowDialog();
         }
     }
 }
        protected override void ShowItemInGridViewRow(DataGridViewRow row, object item)
        {
            PurchaseItemRecord c = item as PurchaseItemRecord;

            row.Tag = c;
            row.Cells["colSheetNo"].Value     = c.SheetNo;
            row.Cells["colProductName"].Value = c.Product.Name;
            row.Cells["colDemandDate"].Value  = c.DemandDate.ToLongDateString();
            row.Cells["colCount"].Value       = c.Count.Trim();
            row.Cells["colReceived"].Value    = c.Received.Trim();
            row.Cells["colOnPurchase"].Value  = c.OnWay.Trim();
            row.Cells["colMemo"].Value        = c.Memo;
        }
Ejemplo n.º 5
0
        public void AddInventoryItem(PurchaseItemRecord pi)
        {
            List <StackInItem> sources = GetDeliveryItemsFromGrid();

            if (!sources.Exists(it => it.ProductID == pi.ProductID && it.PurchaseItem == pi.ID))
            {
                StackInItem item = new StackInItem();
                item.ID            = Guid.NewGuid();
                item.ProductID     = pi.ProductID;
                item.PurchaseItem  = pi.ID;
                item.PurchaseOrder = pi.SheetNo;
                item.OrderItem     = pi.OrderItem;
                item.OrderID       = pi.OrderID;
                item.Unit          = pi.Unit;
                item.Price         = pi.Price;
                item.Count         = pi.OnWay;
                item.Amount        = item.Price * item.Count;
                sources.Add(item);
            }
            ShowSheetItemsOnGrid(sources);
        }