Exemple #1
0
        public static List <RevenueUpdateMasterVM> GetRevenueUpdateList(string ConsignmentNote, DateTime FromDate, DateTime ToDate)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = new SqlConnection(CommanFunctions.GetConnectionString);
            cmd.CommandText = "SP_GetRevenueUpdateList";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@FromDate", SqlDbType.VarChar);
            cmd.Parameters["@FromDate"].Value = FromDate.ToString("MM/dd/yyyy");
            cmd.Parameters.Add("@ToDate", SqlDbType.VarChar);
            cmd.Parameters["@ToDate"].Value = ToDate.ToString("MM/dd/yyyy");
            cmd.Parameters.Add("@ConsignmentNo", SqlDbType.VarChar);
            if (ConsignmentNote == null)
            {
                ConsignmentNote = "";
            }
            cmd.Parameters["@ConsignmentNo"].Value = ConsignmentNote;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);

            List <RevenueUpdateMasterVM> objList = new List <RevenueUpdateMasterVM>();

            if (ds != null && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    RevenueUpdateMasterVM obj = new RevenueUpdateMasterVM();
                    obj.ID                = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["ID"].ToString());
                    obj.ConsignmentNo     = ds.Tables[0].Rows[i]["ConsignmentNo"].ToString();
                    obj.ConsignmentDate   = Convert.ToDateTime(ds.Tables[0].Rows[i]["ConsignmentDate"].ToString()); // CommanFunctions.ParseDate(ds.Tables[0].Rows[i]["RecPayDate"].ToString());
                    obj.Currency          = ds.Tables[0].Rows[i]["CurrencyName"].ToString();
                    obj.PaymentType       = ds.Tables[0].Rows[i]["PaymentType"].ToString();
                    obj.InvoiceTo         = ds.Tables[0].Rows[i]["InvoiceTo"].ToString();
                    obj.DebitAccountName  = ds.Tables[0].Rows[i]["DebitAccountHead"].ToString();
                    obj.CreditAccountName = ds.Tables[0].Rows[i]["CreditAccountHead"].ToString();
                    obj.CustomerName      = ds.Tables[0].Rows[i]["CustomerName"].ToString();
                    if (ds.Tables[0].Rows[i]["Amount"] == DBNull.Value)
                    {
                        obj.Amount = 0;
                    }
                    else
                    {
                        obj.Amount = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["Amount"].ToString());
                    }
                    objList.Add(obj);
                }
            }
            return(objList);
        }
Exemple #2
0
        public static List <RevenueUpdateDetailVM> GetRevenueUpdateDetail(int ID)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = new SqlConnection(CommanFunctions.GetConnectionString);
            cmd.CommandText = "SP_GetRevenueUpdateDetail";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ID", SqlDbType.Int);
            cmd.Parameters["@ID"].Value = ID;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);

            List <RevenueUpdateDetailVM> objList = new List <RevenueUpdateDetailVM>();

            if (ds != null && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    RevenueUpdateDetailVM obj = new RevenueUpdateDetailVM();
                    obj.ID                  = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["ID"].ToString());
                    obj.MasterID            = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["MasterID"].ToString());
                    obj.CurrencyId          = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CurrencyId"].ToString());
                    obj.ExchangeRate        = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["ExchangeRate"].ToString());
                    obj.RevenueCostMasterID = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["RevenueCostMasterID"].ToString());
                    obj.RevenueCost         = ds.Tables[0].Rows[i]["RevenueComponent"].ToString();
                    obj.CustomerId          = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CustomerId"].ToString());
                    obj.Amount              = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["Amount"].ToString());
                    obj.TaxPercent          = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["TaxPercent"].ToString());
                    obj.TaxAmount           = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["TaxAmount"].ToString());
                    obj.TotalCharge         = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["TotalCharge"].ToString());
                    obj.AcHeadDebitId       = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["AcHeadDebitId"].ToString());
                    obj.AcHeadCreditId      = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["AcHeadCreditId"].ToString());
                    obj.PaymentModeId       = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["PaymentModeId"].ToString());
                    obj.InvoiceTo           = ds.Tables[0].Rows[i]["InvoiceTo"].ToString();
                    obj.DebitAccountName    = ds.Tables[0].Rows[i]["DebitAccountHead"].ToString();
                    obj.CreditAccountName   = ds.Tables[0].Rows[i]["CreditAccountHead"].ToString();
                    obj.Currency            = ds.Tables[0].Rows[i]["CurrencyName"].ToString();
                    obj.CustomerName        = ds.Tables[0].Rows[i]["CustomerName"].ToString();
                    obj.PaymentType         = ds.Tables[0].Rows[i]["PaymentType"].ToString();
                    obj.InvoiceNo           = ds.Tables[0].Rows[i]["InvoiceNo"].ToString();
                    objList.Add(obj);
                }
            }
            return(objList);
        }
Exemple #3
0
        public static List <CustomerInvoiceDetailVM> GenerateInvoice(DateTime FromDate, DateTime ToDate, int CustomerId, int FYearId, int InvoiceId)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = new SqlConnection(CommanFunctions.GetConnectionString);
            cmd.CommandText = "SP_GenerateInvoice";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@FromDate", FromDate.ToString("MM/dd/yyyy"));
            cmd.Parameters.AddWithValue("@ToDate", ToDate.ToString("MM/dd/yyyy"));
            cmd.Parameters.AddWithValue("@CustomerId", CustomerId);
            cmd.Parameters.AddWithValue("@FYearId", FYearId);
            cmd.Parameters.AddWithValue("@InvoiceId", InvoiceId);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);

            List <CustomerInvoiceDetailVM> objList = new List <CustomerInvoiceDetailVM>();

            if (ds != null && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    CustomerInvoiceDetailVM obj = new CustomerInvoiceDetailVM();
                    obj.CustomerInvoiceDetailID = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CustomerInvoiceDetailID"].ToString());
                    obj.CustomerInvoiceID       = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CustomerInvoiceID"].ToString());
                    obj.InScanID             = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["InScanId"].ToString());
                    obj.ConsignmentNo        = ds.Tables[0].Rows[i]["ConsignmentNo"].ToString();
                    obj.AWBDateTime          = Convert.ToDateTime(ds.Tables[0].Rows[i]["AWBDateTime"].ToString());
                    obj.FreightCharge        = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["FreightCharge"].ToString());
                    obj.DocCharge            = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["DocCharge"].ToString());
                    obj.CustomsCharge        = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["CustomsCharge"].ToString());
                    obj.OtherCharge          = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["OtherCharge"].ToString());
                    obj.TotalCharges         = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["TotalCharges"].ToString());
                    obj.ConsigneeName        = ds.Tables[0].Rows[i]["Consignee"].ToString();
                    obj.ConsigneeCountryName = ds.Tables[0].Rows[i]["ConsigneeCountryName"].ToString();
                    obj.Origin        = ds.Tables[0].Rows[i]["Consignor"].ToString();
                    obj.ConsigneeName = ds.Tables[0].Rows[i]["Consignee"].ToString();
                    objList.Add(obj);
                }
            }
            return(objList);
        }
Exemple #4
0
        public static List <CustomerInvoiceVM> GetInvoiceList(DateTime FromDate, DateTime ToDate, string InvoiceNo, int FyearId)
        {
            SqlCommand cmd           = new SqlCommand();
            string     strConnString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

            cmd.Connection  = new SqlConnection(strConnString);
            cmd.CommandText = "SP_GetInvoiceList";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@FromDate", FromDate.ToString("MM/dd/yyyy"));
            cmd.Parameters.AddWithValue("@ToDate", ToDate.ToString("MM/dd/yyyy"));
            cmd.Parameters.AddWithValue("@FYearId", FyearId);
            if (InvoiceNo == null)
            {
                InvoiceNo = "";
            }
            cmd.Parameters.AddWithValue("@InvoiceNo", @InvoiceNo);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);
            List <CustomerInvoiceVM> objList = new List <CustomerInvoiceVM>();
            CustomerInvoiceVM        obj;

            if (ds != null && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    obj = new CustomerInvoiceVM();
                    obj.CustomerInvoiceID = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CustomerInvoiceID"].ToString());
                    obj.CustomerInvoiceNo = ds.Tables[0].Rows[i]["CustomerInvoiceNo"].ToString();
                    obj.InvoiceDate       = Convert.ToDateTime(ds.Tables[0].Rows[i]["InvoiceDate"].ToString());
                    obj.CustomerName      = ds.Tables[0].Rows[i]["CustomerName"].ToString();
                    obj.CustomerID        = CommanFunctions.ParseInt(ds.Tables[0].Rows[i]["CustomerID"].ToString());
                    obj.InvoiceTotal      = CommanFunctions.ParseDecimal(ds.Tables[0].Rows[i]["InvoiceTotal"].ToString());
                    objList.Add(obj);
                }
            }
            return(objList);
        }