Example #1
0
 private void dgItemHistory_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         if (dgItemHistory.Columns[e.ColumnIndex] == clDocNumber)
         {
             if (dgItemHistory.Rows[e.RowIndex].Cells["clDocNumber"].Value.ToString().Substring(0, 2) == "IO")
             {
                 string sSalesOrderNumber = dgItemHistory.Rows[e.RowIndex].Cells["clDocNumber"].Value.ToString();
                 Solsage_Process_Management_System.Documents.SalesOrder frmSales = new Solsage_Process_Management_System.Documents.SalesOrder();
                 frmSales.bPermanentMonthEnd = true;
                 frmSales.ShowDialog(sSalesOrderNumber, Convert.ToDateTime(dgItemHistory.Rows[e.RowIndex].Cells["clDate"].Value.ToString()));
             }
             else if (dgItemHistory.Rows[e.RowIndex].Cells["clDocNumber"].Value.ToString().Substring(0, 2) == "IN")
             {
                 string sSalesOrderNumber = dgItemHistory.Rows[e.RowIndex].Cells["clDocNumber"].Value.ToString();
                 Solsage_Process_Management_System.Documents.Invoices frmInvoice = new Documents.Invoices();
                 frmInvoice.ShowDialog(sSalesOrderNumber);
             }
         }
     }
 }
Example #2
0
 private void cmdSalesTest_Click(object sender, EventArgs e)
 {
     Solsage_Process_Management_System.Documents.SalesOrder  frmSales = new Solsage_Process_Management_System.Documents.SalesOrder();
     frmSales.ShowDialog("IO100026",DateTime.Now);
 }
        private void dgProcessStatus_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1) // Sales Order
              {
                  string sSalesOrderNumber = dgProcessStatus.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                  if(sSalesOrderNumber != "")
                  {
                      Solsage_Process_Management_System.Documents.SalesOrder frmSales = new Solsage_Process_Management_System.Documents.SalesOrder();
                     frmSales.bPermanentMonthEnd = false;
                      frmSales.ShowDialog(sSalesOrderNumber, Convert.ToDateTime(dtInvoiceDate.Text));
                  }

              }
              else if (e.ColumnIndex == 2) // Invoice
              {
                  string sInvoiceNumber = dgProcessStatus.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                  if (sInvoiceNumber != "")
                  {
                      Solsage_Process_Management_System.Documents.Invoices frmInvoice = new Solsage_Process_Management_System.Documents.Invoices();
                      frmInvoice.ShowDialog(sInvoiceNumber);
                  }
              }
        }
        private void dgOpenSalesOrder_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                if (dgOpenSalesOrder.Columns[e.ColumnIndex] == clSalesOrderNum)
                {
                    string sSalesOrderNumber = dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderNum"].Value.ToString();
                    Solsage_Process_Management_System.Documents.SalesOrder frmSales = new Solsage_Process_Management_System.Documents.SalesOrder();
                    frmSales.bPermanentMonthEnd = true;
                    frmSales.ShowDialog(sSalesOrderNumber,Convert.ToDateTime(dtInvoiceDate.Text));
                    using (PsqlConnection oLiquidConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
                    {
                        oLiquidConn.Open();
                        string sSql = "select (Select Max(LastInvoiceDate)  from SOLHL where Header = H.DocNumber ) as LastInvoice, Status  from SOLHH h where DocNumber = '" + dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderNum"].Value.ToString().Trim() + "'";
                        using (PsqlDataReader rdReader = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oLiquidConn).ExecuteReader())
                        {
                            while (rdReader.Read())
                            {
                                if (rdReader["Status"].ToString() == "1")
                                {

                                    dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderStatus"].Value = "SAVED";
                                    dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderStatus"].Style = SavedOrderStyle;
                                }
                                else if (rdReader["Status"].ToString() == "2")
                                {
                                    dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderStatus"].Value = "PARTIAL";
                                    dgOpenSalesOrder.Rows[e.RowIndex].Cells["clSalesOrderStatus"].Style = PartialInvoicedStyle;
                                }
                                if (rdReader["LastInvoice"].ToString().Length >= 10)
                                {
                                    dgOpenSalesOrder.Rows[e.RowIndex].Cells["clLastInvoiceDate"].Value = rdReader["LastInvoice"].ToString().Substring(0, 10);
                                }
                            }
                        }
                        dgOpenSalesOrder.Rows[e.RowIndex ].Cells[0].Selected = false;
                        if (e.RowIndex + 1 < dgOpenSalesOrder.Rows.Count)
                        {
                            dgOpenSalesOrder.Rows[e.RowIndex + 1].Cells[0].Selected = true;
                        }
                    }
                    //cmdFilter_Click(null, null);

                }
            }

            //if (dgOpenSalesOrder.Columns[e.ColumnIndex] == chkFutureToActive)
            //{

            //    if (dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkFutureToActive"].Value == chkFutureToActive.TrueValue)
            //    {
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].Value = chkInvoice.FalseValue;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].ReadOnly = false;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].Style = NotReadOnlyStyle;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkActiveToStanding"].ReadOnly = false;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkActiveToStanding"].Style = NotReadOnlyStyle;
            //    }
            //    else if (dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkFutureToActive"].Value == chkFutureToActive.FalseValue)
            //    {
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].Value = chkInvoice.FalseValue;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].ReadOnly = true;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkInvoice"].Style = ReadOnlyStyle;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkActiveToStanding"].Value = chkActiveToStanding.FalseValue;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkActiveToStanding"].ReadOnly = true;
            //        dgOpenSalesOrder.Rows[e.RowIndex].Cells["chkActiveToStanding"].Style = ReadOnlyStyle;
            //    }
            //}
        }