Exemple #1
0
 public string GetInvoiceDetailList(string InvoiceNO, out List<InvoiceDataTypes.InvoiceDetailsDataType> _ExistDataList)
     {
         _ExistDataList = new List<InvoiceDataTypes.InvoiceDetailsDataType>();
         try
             {
             MySqlCommand oSqlCommand = new MySqlCommand();
             string sqlQuery = "Select ItemNo, InvoiceNO   from tblrecievebleinvoicedetails"
            + " Where 1=1 "
            + " and InvoiceNO=@InvoiceNO";
             oSqlCommand.Parameters.AddWithValue("@InvoiceNO", InvoiceNO);
             DataTable tb = Mycommon.GetDataTableAccount(sqlQuery, oSqlCommand, "get Invoice List");
             if (tb != null)
                 {
                 foreach (DataRow r in tb.Rows)
                     {
                         InvoiceDataTypes.InvoiceDetailsDataType _ExOneData = new InvoiceDataTypes.InvoiceDetailsDataType();
                         int i = 0;
                         bool resp = int.TryParse(r["ItemNo"].ToString(), out i);
                         string respond = "";
                         respond = GetExistInvoiceDetails(i, InvoiceNO, out _ExOneData);
                         if (respond == "True")
                             _ExistDataList.Add(_ExOneData);
                     }
                 return "True";
                 }
             return "No data Found";
             }
         catch (Exception ex)
             {
             return ex.Message;
             }
     }
Exemple #2
0
 public string GetExistInvoiceDetails(int ItemNo, string InvoiceNO, out InvoiceDataTypes.InvoiceDetailsDataType _ExistData)
     {
     _ExistData = new InvoiceDataTypes.InvoiceDetailsDataType();
     MySqlCommand oSqlCommand = new MySqlCommand();
     string sqlQuery = "Select "
   + "ItemNo,"
   + "InvoiceNO,"
   + "AccID,"
   + "Description,"
   + "Cr,"
   + "FCr,"
   + "TrRef,"
   + "Vat"
   + " from tblrecievebleinvoicedetails"
   + " Where 1=1 "
         + " and ItemNo=@ItemNo"
         + " and InvoiceNO=@InvoiceNO";
     oSqlCommand.Parameters.AddWithValue("@ItemNo", ItemNo);
     oSqlCommand.Parameters.AddWithValue("@InvoiceNO", InvoiceNO);
     DataRow r = Mycommon.GetDataRowAccount(sqlQuery, oSqlCommand,  "Get Exist data InvoiceDetails");
     if (r != null)
         {
         try
             {
             bool resp = false;
             int inItemNo = 0;
             resp = int.TryParse(r["ItemNo"].ToString(), out inItemNo);
             _ExistData.ItemNo = inItemNo;
             _ExistData.InvoiceNO = r["InvoiceNO"].ToString();
             _ExistData.AccID = r["AccID"].ToString();
             _ExistData.Description = r["Description"].ToString();
             decimal deCr = 0;
             resp = decimal.TryParse(r["Cr"].ToString(), out deCr);
             _ExistData.Cr = deCr;
             decimal deFCr = 0;
             resp = decimal.TryParse(r["FCr"].ToString(), out deFCr);
             _ExistData.FCr = deFCr;
             _ExistData.TrRef = r["TrRef"].ToString();
             decimal deVat = 0;
             resp = decimal.TryParse(r["Vat"].ToString(), out deVat);
             _ExistData.Vat = deVat;
             return "True";
             }
         catch (Exception ex)
             {
             return ex.Message;
             }
         }
     else
         return "data not found ";
     }
Exemple #3
0
        private string SetDetailsToClass(out List<InvoiceDataTypes.InvoiceDetailsDataType> _DetailList)
        {
            _DetailList = new List<InvoiceDataTypes.InvoiceDetailsDataType>();

            try
            {
                if (dgvAccount.Rows.Count > 0)
                {
                    foreach (DataGridViewRow r in dgvAccount.Rows)
                    {
                        InvoiceDataTypes.InvoiceDetailsDataType _OneDAta = new InvoiceDataTypes.InvoiceDetailsDataType();
                        decimal TotalLKR = 0, TotalUSD = 0,Vat=0;
                        bool resp = decimal.TryParse(r.Cells["dgvAccount_Amount"].Value.ToString(), out  TotalLKR);
                        resp = decimal.TryParse(r.Cells["dgvAccount_Fcr"].Value.ToString(), out  TotalUSD);
                        resp = decimal.TryParse(r.Cells["dgvAccount_VAT"].Value.ToString(), out  Vat);
                        int i = 0;
                        resp = int.TryParse(r.Cells["dgvAccount_LineRef"].Value.ToString(), out i);

                        _OneDAta.AccID = r.Cells["dgvAccount_ID"].Value.ToString();
                        _OneDAta.Cr = TotalLKR;
                        _OneDAta.Description = r.Cells["dgvAccount_Memo"].Value.ToString();
                        _OneDAta.FCr = TotalUSD;
                        _OneDAta.InvoiceNO = cmbGRN.Text;
                        _OneDAta.ItemNo = i;
                        _OneDAta.Vat = Vat;
                        _DetailList.Add(_OneDAta);
                    }
                    return "True";
                }
                else
                {
                    return "No Data To Save";
                }
            }
            catch (Exception ex)
            {

                return ex.Message;
            }
        }