//--------------------------------------- // VIEW PRICE QUOTATION BUTTON METHODS | //--------------------------------------- private void btnViewPQ_Click(object sender, EventArgs e) { string pqNo = dgvPQ.SelectedRows[0].Cells[2].Value.ToString(); PQ p = sql.SelectPQDetails(pqNo); //---SET values in forms' labels & DISPLAY the view form PQ_ViewForm pqvf = new PQ_ViewForm(); pqvf.PQNoToView = p.PQNo; pqvf.PQDateToView = p.PQDate; pqvf.FromDatetoView = p.PQFromDate; pqvf.ToDatetoView = p.PQToDate; pqvf.PaymentTermsToView = p.PaymentTerms; pqvf.InFavorOfToView = p.InFavorOf; pqvf.DeliveryTermsToView = p.DeliveryTerms; pqvf.CustomerNameToView = dgvPQ.SelectedRows[0].Cells[1].Value.ToString(); //Retrieve other Customer Details Customer c = sql.SelectCustomerDetails(p.CustomerID); pqvf.CustomerPersonToView = c.CustomerPerson; pqvf.CustomerNumberToView = c.CustomerNumber; pqvf.CustomerEmailToView = c.CustomerEmail; pqvf.CustomerAddressToView = c.CustomerAddress; //Retrieve Order Line Details //Happens in View Form: at PQ_OrderLine_Load //Open PQ_ViewForm.cs pqvf.ShowDialog(); }
private void btnCreatePQ_Click(object sender, EventArgs e) { if (dgvRFQSelected.Rows.Count == 0) { MessageBox.Show("Please include Request for Price Quotation.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Close(); PQ_CreateForm pf = new PQ_CreateForm(); for (int i = 0; i < dgvRFQSelected.RowCount; i++) { string rfqNo; DataGridViewRow row = dgvRFQSelected.Rows[i]; rfqNo = (row.Cells["SelectedRFQNo"].Value).ToString(); //get the RFQNo of the rfq selected RFQ r = sql.SelectRFQDetails(rfqNo); //from the RFQNo taken, get its details selectedRFQList.Add(new RFQ(r.RFQNo, r.RequestDate, r.PaymentTerms, r.DeliveryTerms, r.CustomerID, r.SupplierID, r.PQNo)); //put in an ArrayList the details taken pf.RFQNo = rfqNo; string year = DateTime.Now.ToString("yy"); string month = DateTime.Now.ToString("MM"); int pqCount = sql.GetRowCount("pq_t", year, month); string generatedPQNo = year + month + "-" + (pqCount + 1).ToString("D3"); pf.PQNo = generatedPQNo; pf.PaymentTerms = r.PaymentTerms; pf.DeliveryTerms = r.DeliveryTerms; Customer c = sql.SelectCustomerDetails(r.CustomerID); //to retrieve the details of Customer from MySqlDatabaseDriver pf.CustomerName = c.CustomerName; pf.CustomerPerson = c.CustomerPerson; pf.CustomerNumber = c.CustomerNumber; pf.CustomerEmail = c.CustomerEmail; pf.CustomerAddress = c.CustomerAddress; pf.ShowDialog(); } if (pf.Cancel == false) {//if save button were clicked, this will save the pq details in arrayList then in the database string FromDateNoTime = pf.FromDate.ToShortDateString(); string ToDateNoTime = pf.ToDate.ToShortDateString(); string PQDateNoTime = pf.PQDate.ToShortDateString(); pqList.Add(new PQ(pf.PQNo, PQDateNoTime, FromDateNoTime, ToDateNoTime, pf.PaymentTerms, pf.DeliveryTerms, pf.BillTo, pf.ShipTo, pf.InFavorOf, double.Parse(pf.TotalAmount), pf.CustomerIDFK)); PQ newPQ = (PQ)pqList[(pqList.Count - 1)]; sql.InsertPQ(newPQ); for (int j = 0; j < pf.PQOrderLineList.Count; j++) { PQ_OrderLine pol = (PQ_OrderLine)pf.PQOrderLineList[j]; sql.InsertPQOrderLine(pol); //MessageBox.Show("OrderLine added to comprehensive list: " + pol.PQNo + ", " + pol.PartNumber + ", " + pol.ReicUnitPrice + "," + pol.Quantity + "," + pol.ItemTotal); } //---OPEN THE PQ Printout Print Preview /*if (pf.InFavorOf == "Supplier") * { * PQ_PrintScreen_IFOSupplier pq = new PQ_PrintScreen_IFOSupplier(); * pq.PQNo = pf.PQNo; * pq.FirstTime = false; * pq.ShowDialog(); * } * else * { * PQ_PrintScreen pq = new PQ_PrintScreen(); * pq.PQNo = pf.PQNo; * pq.FirstTime = false; * pq.ShowDialog(); * }*/ } }
private void btnCreatePO_Click(object sender, EventArgs e) { if (dgvPQSelected.Rows.Count == 0) { MessageBox.Show("Please include Price Quotation.", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Close(); PO_CreateForm pof = new PO_CreateForm(); for (int i = 0; i < dgvPQSelected.RowCount; i++) { string pqNo; DataGridViewRow row = dgvPQSelected.Rows[i]; pqNo = (row.Cells["SelectedPQNo"].Value).ToString(); //get the PQNo of the pq selected PQ p = sql.SelectPQDetails(pqNo); //from the RFQNo taken, get its details selectedPQList.Add(new PQ(p.PQNo, p.PQDate, p.PQFromDate, p.PQToDate, p.PaymentTerms, p.DeliveryTerms, p.BillTo, p.ShipTo, p.InFavorOf, p.TotalAmount, p.CustomerID)); //put in an ArrayList the details taken pof.PQNo = pqNo; PQ_OrderLine pqol = sql.SelectPQOrderLine(pqNo); pqOrderLineList.Add(new PQ_OrderLine(pqol.PQNo, pqol.PartNumber, pqol.ReicUnitPrice, pqol.Quantity, pqol.ItemTotal)); for (int j = 0; j < pqOrderLineList.Count; j++) { Item item = sql.SelectItemDetails(pqol.PartNumber); itemList.Add(new Item(item.PartNumber, item.ItemName, item.ItemDescription, item.SupplierUnitPrice, item.Markup, item.ReicUnitPrice, item.Moq, item.Uom, item.FromDateNoTime, item.ToDateNoTime, item.SupplierID)); Supplier s = sql.SelectSupplierDetails(item.SupplierID); pof.SupplierName = s.SupplierName; pof.SupplierPerson = s.SupplierPerson; pof.SupplierNumber = s.SupplierNumber; pof.SupplierEmail = s.SupplierEmail; pof.SupplierAddress = s.SupplierAddress; pof.SupplierID = item.SupplierID.ToString(); MessageBox.Show("umabot ka dito"); } /* * string year = DateTime.Now.ToString("yy"); * string month = DateTime.Now.ToString("MM"); * int pqCount = sql.GetRowCount("pq_t", year, month); * string generatedPONo = year + month + "-" + (pqCount + 1).ToString("D3"); * pof.PONo = generatedPONo; * * pf.PaymentTerms = r.PaymentTerms; * pf.DeliveryTerms = r.DeliveryTerms; */ Customer c = sql.SelectCustomerDetails(p.CustomerID); //to retrieve the details of Customer from MySqlDatabaseDriver pof.CustomerName = c.CustomerName; /* pf.CustomerPerson = c.CustomerPerson; * pf.CustomerNumber = c.CustomerNumber; * pf.CustomerEmail = c.CustomerEmail; * pf.CustomerAddress = c.CustomerAddress;*/ pof.ShowDialog(); if (pof.Cancel == false) {//if save button were clicked, this will save the pq details in arrayList then in the database string OrderDateNoTime = pof.OrderDate.ToShortDateString(); string RequiredDateNoTime = pof.RequiredDate.ToShortDateString(); poList.Add(new PO(pof.PONo, OrderDateNoTime, RequiredDateNoTime, pof.OrderDesc, pof.PQNo, pof.PaymentTerms, pof.DeliveryTerms, double.Parse(pof.NetSubTotal), double.Parse(pof.DeliveryCosts), double.Parse(pof.OrderTotal), int.Parse(pof.SupplierID), pof.CustomerIDFK, null)); PO newPO = (PO)poList[(poList.Count - 1)]; sql.InsertPO(newPO); for (int j = 0; j < pof.POOrderLineList.Count; j++) { PO_OrderLine pol = (PO_OrderLine)pof.POOrderLineList[j]; sql.InsertPOOrderLine(pol); MessageBox.Show("OrderLine added to comprehensive list: " + pol.PONo + ", " + pol.PartNumber + ", " + pol.SupplierUnitPrice + "," + pol.Quantity + "," + pol.ItemTotal); } } } }