Esempio n. 1
0
        public static List <paymentvoucherdetail> getVoucherDetail(paymentvoucher vh)
        {
            paymentvoucherdetail        vd;
            List <paymentvoucherdetail> VDetail = new List <paymentvoucherdetail>();

            try
            {
                string        query = "";
                SqlConnection conn  = new SqlConnection(Login.connString);
                query = "select RowID,DocumentID,TemporaryNo, TemporaryDate,AccountCode,AccountName,AmountDebit,AmountDebitINR,AmountCredit,AmountCreditINR, " +
                        "ChequeNo,ChequeDate" +
                        " from ViewPaymentVoucher " +
                        "where DocumentID='" + vh.DocumentID + "'" +
                        " and TemporaryNo=" + vh.TemporaryNo +
                        " and TemporaryDate='" + vh.TemporaryDate.ToString("yyyy-MM-dd") + "'";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    vd                 = new paymentvoucherdetail();
                    vd.RowID           = reader.GetInt32(0);
                    vd.DocumentID      = reader.GetString(1);
                    vd.TemporaryNo     = reader.GetInt32(2);
                    vd.TemporaryDate   = reader.GetDateTime(3);
                    vd.AccountCode     = reader.GetString(4);
                    vd.AccountName     = reader.IsDBNull(5)?"":reader.GetString(5);
                    vd.AmountDebit     = reader.GetDecimal(6);
                    vd.AmountDebitINR  = reader.GetDecimal(7);
                    vd.AmountCredit    = reader.GetDecimal(8);
                    vd.AmountCreditINR = reader.GetDecimal(9);
                    vd.ChequeNo        = reader.GetString(10);
                    vd.ChequeDate      = reader.IsDBNull(11) ? DateTime.Parse("1900-01-01") : reader.GetDateTime(11);
                    VDetail.Add(vd);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error querying MRN Details");
            }
            return(VDetail);
        }
Esempio n. 2
0
        public static List <paymentvoucherdetail> getVoucherDetail(paymentvoucher vh)
        {
            paymentvoucherdetail        vd;
            List <paymentvoucherdetail> VDetail = new List <paymentvoucherdetail>();

            try
            {
                string        query = "";
                SqlConnection conn  = new SqlConnection(Login.connString);
                query = "select RowID,DocumentID,TemporaryNo, TemporaryDate,AccountCodeDebit,AccountNameDebit,AmountDebit,BillNo,BillDate, " +
                        "ChequeNo,ChequeDate" +
                        " from ViewPaymentVoucher " +
                        "where DocumentID='" + vh.DocumentID + "'" +
                        " and TemporaryNo=" + vh.TemporaryNo +
                        " and TemporaryDate='" + vh.TemporaryDate.ToString("yyyy-MM-dd") + "'";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    vd                  = new paymentvoucherdetail();
                    vd.RowID            = reader.GetInt32(0);
                    vd.DocumentID       = reader.GetString(1);
                    vd.TemporaryNo      = reader.GetInt32(2);
                    vd.TemporaryDate    = reader.GetDateTime(3).Date;
                    vd.AccountCodeDebit = reader.GetString(4);
                    vd.AccountNameDebit = reader.GetString(5);
                    vd.AmountDebit      = reader.GetDecimal(6);
                    vd.BillNo           = reader.GetString(7);
                    vd.BillDate         = reader.GetDateTime(8);
                    vd.ChequeNo         = reader.GetString(9);
                    vd.ChequeDate       = reader.GetDateTime(10);
                    VDetail.Add(vd);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(VDetail);
        }