示例#1
0
 /// <summary>
 /// Function to fill additional cost grid
 /// </summary>
 public void AdditionalCostGridFill()
 {
     DataTable dtbl = new DataTable();
     PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
     AdditionalCostSP spAdditionalCost = new AdditionalCostSP();
     try
     {
         dtbl = spPurchaseMaster.AccountLedgerViewForAdditionalCost();
         DataRow dr = dtbl.NewRow();
         dr["ledgerName"] = string.Empty;
         dr["ledgerId"] = 0;
         dtbl.Rows.InsertAt(dr, 0);
         dgvcmbLedger.DataSource = dtbl;
         dgvcmbLedger.DisplayMember = "ledgerName";
         dgvcmbLedger.ValueMember = "ledgerId";
         if (decPurchaseMasterId == 0)
         {
             AdditionalCostComboFill(0);
         }
         else
         {
             dtbl = spAdditionalCost.AdditionalCostViewAllByVoucherTypeIdAndVoucherNo(decPurchaseInvoiceVoucherTypeId, strVoucherNo);
             dgvAdditionalCost.DataSource = dtbl;
         }
         AdditionalCostSerialNo();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI26:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#2
0
 /// <summary>
 /// Function to fill additional cost combo box
 /// </summary>
 /// <param name="inRowIndex"></param>
 public void AdditionalCostComboFill(int inRowIndex)
 {
     DataTable dtbl = new DataTable();
     PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
     try
     {
         dtbl = spPurchaseMaster.AccountLedgerViewForAdditionalCost();
         DataRow drow = dtbl.NewRow();
         drow["ledgerName"] = string.Empty;
         drow["ledgerId"] = 0;
         dtbl.Rows.InsertAt(drow, 0);
         if (dgvAdditionalCost.RowCount > 1)
         {
             foreach (DataGridViewRow dgvrow in dgvAdditionalCost.Rows)
             {
                 foreach (DataRow drow1 in dtbl.Rows)
                 {
                     if (dgvrow.Index != inRowIndex)
                     {
                         if (dgvrow.Cells["dgvcmbLedger"].Value != null)
                         {
                             if (drow1["ledgerId"].ToString() == dgvrow.Cells["dgvcmbLedger"].Value.ToString())
                             {
                                 dtbl.Rows.RemoveAt(dtbl.Rows.IndexOf(drow1));
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         DataGridViewComboBoxCell dgvcmbLedgerCell = (DataGridViewComboBoxCell)dgvAdditionalCost.Rows[inRowIndex].Cells[dgvAdditionalCost.Columns["dgvcmbLedger"].Index];
         dgvcmbLedgerCell.DataSource = dtbl;
         dgvcmbLedgerCell.DisplayMember = "ledgerName";
         dgvcmbLedgerCell.ValueMember = "ledgerId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }