示例#1
0
        public PurchaseOrderViewModel GetAsset_master(string ordno)
        {
            db.Configuration.ProxyCreationEnabled = true;
            purchase_order         x       = db.purchase_order.Where(y => y.pd_order_no == ordno).FirstOrDefault();
            PurchaseOrderViewModel pvModel = new PurchaseOrderViewModel();

            if (x == null)
            {
            }

            else
            {
                pvModel.pd_id        = x.pd_id;
                pvModel.pd_order_no  = x.pd_order_no;
                pvModel.pd_ad_id     = x.asset_def.ad_id;
                pvModel.assetname    = x.asset_def.ad_name;
                pvModel.pd_odateStr  = x.pd_odateStr;
                pvModel.pd_ddateStr  = x.pd_ddateStr;
                pvModel.pd_qty       = Convert.ToInt32(x.pd_qty);
                pvModel.pd_status    = x.pd_status;
                pvModel.pd_type_id   = x.asset_type.at_id;
                pvModel.assettype    = x.asset_type.at_name;
                pvModel.pd_vendor_id = x.pd_vendor_id;
                pvModel.vendor_name  = x.vendor_creation.vd_name;
            }

            return(pvModel);
        }
示例#2
0
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int id_contact = sbxContact.ContactID;

            if (purchase_orderViewSource != null)
            {
                if (purchase_orderViewSource.View != null)
                {
                    if (purchase_orderViewSource.View.Cast <purchase_order>().Count() > 0)
                    {
                        purchase_orderViewSource.View.Filter = i =>
                        {
                            purchase_order purchase_order = (purchase_order)i;
                            if (purchase_order.id_contact == id_contact)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        };
                    }
                }
            }
        }
示例#3
0
        public IHttpActionResult Postpurchase_order(purchase_order purchase_order)
        {
            db.purchase_order.Add(purchase_order);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = purchase_order.pd_id }, purchase_order));
        }
 public IHttpActionResult PutPurchase_order(int id, purchase_order purchase_order)
 {
     count = Convert.ToDecimal(purchase_order.pd_qty);
     db.Entry(purchase_order).State = EntityState.Modified;
     db.SaveChanges();
     return(StatusCode(HttpStatusCode.NoContent));
 }
示例#5
0
        //Purchase Order
        public void Document_PrintPurchaseOrder(int document_id, purchase_order purchase_order)
        {
            app_document app_document;

            using (db db = new db())
            {
                app_document = db.app_document.Where(x => x.id_document == document_id).FirstOrDefault();
            }
            if (app_document != null)
            {
                if (purchase_order.app_document_range.printer_name != null)
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadPurchaseOrderReport(purchase_order.id_purchase_order);
                }
                else
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadPurchaseOrderReport(purchase_order.id_purchase_order);
                    Window window = new Window
                    {
                        Title   = "Report",
                        Content = MainWindow
                    };

                    window.ShowDialog();
                }
            }
        }
示例#6
0
        public IHttpActionResult Putpurchase_order(decimal id, purchase_order purchase_order)
        {
            if (id != purchase_order.pd_id)
            {
                return(BadRequest());
            }

            db.Entry(purchase_order).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!purchase_orderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#7
0
 private void toolBar_btnSearch_Click(object sender, string query)
 {
     try
     {
         if (!string.IsNullOrEmpty(query))
         {
             purchase_orderViewSource.View.Filter = i =>
             {
                 purchase_order purchase_order = i as purchase_order;
                 if (purchase_order.contact.name.ToLower().Contains(query.ToLower()))
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             };
         }
         else
         {
             purchase_orderViewSource.View.Filter = null;
         }
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }
示例#8
0
        public ActionResult DeleteConfirmed(int id)
        {
            purchase_order purchase_order = db.purchase_order.Find(id);

            db.purchase_order.Remove(purchase_order);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#9
0
 private void sales_orderDatagrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e)
 {
     if (_entity.purchase_order_detail.Count() > 0)
     {
         purchase_order _purchase_order  = ((System.Windows.Controls.DataGrid)sender).SelectedItem as purchase_order;
         Task           task_PrimaryData = Task.Factory.StartNew(() => LoadOrderDetail(_purchase_order, e));
     }
 }
示例#10
0
        private void Hyperlink_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            purchase_order purchase_order = purchase_orderDataGrid.SelectedItem as purchase_order;

            foreach (purchase_order_detail purchase_order_detail in purchase_order.purchase_order_detail)
            {
                purchase_order_detail.Quantity_Factored = entity.Brillo.ConversionFactor.Factor_Quantity(purchase_order_detail.item, purchase_order_detail.quantity, purchase_order_detail.GetDimensionValue());
                purchase_order_detail.RaisePropertyChanged("Quantity_Factored");
            }
        }
示例#11
0
        private void purchaseorder_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            Hyperlink      Hyperlink      = (Hyperlink)sender;
            purchase_order purchase_order = (purchase_order)Hyperlink.Tag;

            if (purchase_order != null)
            {
                entity.Brillo.Logic.Document Document = new entity.Brillo.Logic.Document();
                Document.Document_PrintPurchaseOrder(0, purchase_order);
            }
        }
示例#12
0
 public ActionResult Edit([Bind(Include = "po_id,company_name,delivery_dat,po_date,tax_id")] purchase_order purchase_order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(purchase_order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.tax_id = new SelectList(db.Taxes, "tax_id", "tax_id", purchase_order.tax_id);
     return(View(purchase_order));
 }
 public ActionResult Edit([Bind(Include = "purchase_order_id,fk_supplier,purchase_order_created_at,purchase_order_total_money,purchase_order_status")] purchase_order purchase_order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(purchase_order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.fk_supplier = new SelectList(db.suppliers, "supplier_id", "supplier_name", purchase_order.fk_supplier);
     return(View(purchase_order));
 }
示例#14
0
        public IHttpActionResult Postpurchase_order(purchase_order purchase_order)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.purchase_order.Add(purchase_order);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = purchase_order.pd_id }, purchase_order));
        }
示例#15
0
        public IHttpActionResult Deletepurchase_order(decimal id)
        {
            purchase_order purchase_order = db.purchase_order.Find(id);

            if (purchase_order == null)
            {
                return(NotFound());
            }

            db.purchase_order.Remove(purchase_order);
            db.SaveChanges();
            return(Ok(purchase_order));
        }
示例#16
0
        private void set_ContactPref(object sender, EventArgs e)
        {
            if (sbxContact.ContactID > 0)
            {
                contact        contact        = PurchaseOrderDB.contacts.Where(x => x.id_contact == sbxContact.ContactID).FirstOrDefault();
                purchase_order purchase_order = (purchase_order)purchase_orderDataGrid.SelectedItem;
                purchase_order.id_contact = contact.id_contact;
                purchase_order.contact    = contact;

                ///Start Thread to get Data.
                Task thread_SecondaryData = Task.Factory.StartNew(() => set_ContactPref_Thread(contact));
            }
        }
示例#17
0
        private void New_Click(object sender)
        {
            OrderSetting _pref_PurchaseOrder = new OrderSetting();

            purchase_order purchase_order = PurchaseOrderDB.New();

            purchase_order.trans_date = DateTime.Now.AddDays(_pref_PurchaseOrder.TransDate_OffSet);

            PurchaseOrderDB.Entry(purchase_order).State = EntityState.Added;
            purchase_orderViewSource.View.MoveCurrentToLast();

            sbxContact.Text = "";
        }
示例#18
0
        private void toolBar_btnPrint_Click(object sender, MouseButtonEventArgs e)
        {
            purchase_order purchase_order = purchase_orderDataGrid.SelectedItem as purchase_order;

            if (purchase_order != null)
            {
                entity.Brillo.Document.Start.Manual(purchase_order, purchase_order.app_document_range);
            }
            else
            {
                toolBar.msgWarning("Please select");
            }
        }
示例#19
0
        // GET: purchase_order/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            purchase_order purchase_order = db.purchase_order.Find(id);

            if (purchase_order == null)
            {
                return(HttpNotFound());
            }
            return(View(purchase_order));
        }
示例#20
0
 private void toolBar_btnEdit_Click(object sender)
 {
     if (purchase_orderDataGrid.SelectedItem != null)
     {
         purchase_order purchase_order_old = (purchase_order)purchase_orderDataGrid.SelectedItem;
         purchase_order_old.IsSelected = true;
         purchase_order_old.State      = EntityState.Modified;
         PurchaseOrderDB.Entry(purchase_order_old).State = EntityState.Modified;
     }
     else
     {
         toolBar.msgWarning("Please Select a record");
     }
 }
示例#21
0
 private void LoadOrderDetail(purchase_order purchase_order, DataGridRowDetailsEventArgs e)
 {
     if (_entity.purchase_order_detail.Count() > 0)
     {
         Dispatcher.Invoke(new Action(() =>
         {
             System.Windows.Controls.DataGrid RowDataGrid = e.DetailsElement as System.Windows.Controls.DataGrid;
             if (RowDataGrid != null)
             {
                 RowDataGrid.ItemsSource = purchase_order.purchase_order_detail;
             }
         }));
     }
 }
        // GET: Administrator/purchase_order/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            purchase_order purchase_order = db.purchase_order.Find(id);

            if (purchase_order == null)
            {
                return(HttpNotFound());
            }
            ViewBag.fk_supplier = new SelectList(db.suppliers, "supplier_id", "supplier_name", purchase_order.fk_supplier);
            return(View(purchase_order));
        }
示例#23
0
        // GET: purchase_order/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            purchase_order purchase_order = db.purchase_order.Find(id);

            if (purchase_order == null)
            {
                return(HttpNotFound());
            }
            ViewBag.tax_id = new SelectList(db.Taxes, "tax_id", "tax_id", purchase_order.tax_id);
            return(View(purchase_order));
        }
示例#24
0
        //private void purchase_invoiceDataGrid_Loaded(object sender, RoutedEventArgs e)
        //{
        //    calculate_total(sender, e);
        //}

        private void purchase_orderDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                purchase_order purchase_order = (purchase_order)purchase_orderDataGrid.SelectedItem;
                if (purchase_order != null)
                {
                    calculate_vat(sender, e);
                }
                //calculate_total(sender, e);
            }
            catch (Exception ex)
            {
                toolBar.msgError(ex);
            }
        }
示例#25
0
        private void cbxCurrency_LostFocus(object sender, RoutedEventArgs e)
        {
            purchase_order purchase_order = purchase_orderDataGrid.SelectedItem as purchase_order;

            if (purchase_order != null)
            {
                if (purchase_order.id_currencyfx > 0)
                {
                    if (PurchaseOrderDB.app_currencyfx.Where(x => x.id_currencyfx == purchase_order.id_currencyfx).FirstOrDefault() != null)
                    {
                        purchase_order.app_currencyfx = PurchaseOrderDB.app_currencyfx.Where(x => x.id_currencyfx == purchase_order.id_currencyfx).FirstOrDefault();
                    }
                }
            }
            calculate_vat(sender, e);
        }
示例#26
0
        protected void GenerateGrid()
        {
            int id = (int)Session["po"];

            GridView1.DataSource = BusinessLogic.getpurchaseorderdetail(id);
            GridView1.DataBind();
            purchase_order p = BusinessLogic.getpurchaseorder(id);
            supplier       s = BusinessLogic.getSupplierNameforPurchaseorder(id);
            employee       d = BusinessLogic.GetEmployee(p.employee_id);

            Label5.Text  = id.ToString();
            Label4.Text  = s.supplier_name;
            Label7.Text  = s.supplier_id;
            Label9.Text  = p.purchase_order_date.ToString("dd-MM-yyyy");
            Label11.Text = p.purchase_order_status;
            Label13.Text = d.employee_name;
        }
示例#27
0
        private void item_Select(object sender, EventArgs e)
        {
            purchase_order purchase_order = purchase_orderDataGrid.SelectedItem as purchase_order;
            item           item           = null;
            contact        contact        = null;

            if (sbxItem.ItemID > 0)
            {
                item = PurchaseOrderDB.items.Where(x => x.id_item == sbxItem.ItemID).FirstOrDefault();
                if (sbxContact.ContactID > 0)
                {
                    contact = PurchaseOrderDB.contacts.Where(x => x.id_contact == sbxContact.ContactID).FirstOrDefault();
                }
            }

            Task Thread = Task.Factory.StartNew(() => SelectProduct_Thread(sender, e, purchase_order, item, contact));
        }
示例#28
0
 private void toolBar_btnDelete_Click(object sender)
 {
     try
     {
         if (MessageBox.Show("Are you sure want to Delete?", "Cognitivo ERP", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             purchase_order purchase_order = (purchase_order)purchase_orderDataGrid.SelectedItem;
             purchase_order.is_head    = false;
             purchase_order.State      = EntityState.Deleted;
             purchase_order.IsSelected = true;
         }
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int id = Convert.ToInt32(Request.QueryString["id"]);
         GridView1.DataSource = BusinessLogic.getpurchaseorderdetail(id);
         GridView1.DataBind();
         purchase_order p = BusinessLogic.getpurchaseorder(id);
         supplier       s = BusinessLogic.getSupplierNameforPurchaseorder(id);
         employee       d = BusinessLogic.GetEmployee(p.employee_id);
         Label5.Text  = id.ToString();
         Label4.Text  = s.supplier_name;
         Label7.Text  = s.supplier_id;
         Label9.Text  = p.purchase_order_date.ToString("dd-MM-yyyy");
         Label11.Text = p.purchase_order_status;
         Label13.Text = d.employee_name;
     }
 }
示例#30
0
 private void DeleteCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         MessageBoxResult result = MessageBox.Show("Are you sure want to Delete?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             purchase_order purchase_order = purchase_orderViewSource.View.CurrentItem as purchase_order;
             //DeleteDetailGridRow
             purchase_order_detailDataGrid.CancelEdit();
             purchase_order.purchase_order_detail.Remove(e.Parameter as purchase_order_detail);
             purchase_orderpurchase_order_detailViewSource.View.Refresh();
             // calculate_total(sender, e);
         }
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }