Ejemplo n.º 1
0
        public static List <CustomerOBdetail> getCustomerOBDetail(CustomerOBheader Acchr)
        {
            CustomerOBdetail        Accd;
            List <CustomerOBdetail> AccDetail = new List <CustomerOBdetail>();

            try
            {
                string        query = "";
                SqlConnection conn  = new SqlConnection(Login.connString);
                query = "select RowID,DocumentID,DocumentNo,DocumentDate,SerialNo, " +
                        "CustomerID,CustomerName,BalanceDebit,BalanceCredit " +
                        "from ViewCustomerOB " +
                        " where DocumentID='" + Acchr.DocumentID + "'" +
                        " and DocumentNo=" + Acchr.DocumentNo +
                        " and DocumentDate='" + Acchr.DocumentDate.ToString("yyyy-MM-dd") + "'" + " order by SerialNo";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Accd              = new CustomerOBdetail();
                    Accd.RowID        = reader.GetInt32(0);
                    Accd.DocumentID   = reader.GetString(1);
                    Accd.DocumentNo   = reader.GetInt32(2);
                    Accd.DocumentDate = reader.GetDateTime(3).Date;
                    if (!reader.IsDBNull(4))
                    {
                        Accd.SerialNo = reader.GetInt32(4);
                    }
                    Accd.AccountCode   = reader.GetString(5);
                    Accd.AccountName   = reader.GetString(6);
                    Accd.BalanceDebit  = reader.GetDecimal(7);
                    Accd.BalanceCredit = reader.GetDecimal(8);
                    AccDetail.Add(Accd);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(AccDetail);
        }
Ejemplo n.º 2
0
        /////////Subledger modification
        public static List <CustomerOBdetail> getCustomerOBListForPericualrFY(string fy)
        {
            CustomerOBdetail        cust;
            List <CustomerOBdetail> CustDetail = new List <CustomerOBdetail>();

            try
            {
                string        query = "";
                SqlConnection conn  = new SqlConnection(Login.connString);
                query = "select RowID,DocumentID,DocumentNo,DocumentDate,SerialNo, " +
                        "CustomerID,CustomerName,BalanceDebitINR,BalanceCreditINR,(BalanceDebitINR-BalanceCreditINR) " +
                        "from ViewCustomerOB " +
                        " where FYID='" + fy.Trim() + "' and status = 1";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    cust              = new CustomerOBdetail();
                    cust.RowID        = reader.GetInt32(0);
                    cust.DocumentID   = reader.GetString(1);
                    cust.DocumentNo   = reader.GetInt32(2);
                    cust.DocumentDate = reader.GetDateTime(3).Date;
                    if (!reader.IsDBNull(4))
                    {
                        cust.SerialNo = reader.GetInt32(4);
                    }
                    cust.AccountCode   = reader.GetString(5);
                    cust.AccountName   = reader.GetString(6);
                    cust.BalanceDebit  = reader.GetDecimal(7);
                    cust.BalanceCredit = reader.GetDecimal(8);
                    cust.OBValue       = reader.GetDecimal(9);
                    CustDetail.Add(cust);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(CustDetail);
        }