تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
جلب أقل قيمة سعر من جدول الى الداتاغريد
#1
السلام عليكم رحمة الله تعالى وبركاته


يا جماعة أحاول أن أجلب أقل قيمة سعر للمنتج في نافذة المشتريات ، ولكن الذي يحصل انني أستطيع جلب المنتج الاول في الحقل الاول للداتا ثم يرفض الاستعلام جلب حقول اخرى للداتا والصور اعتقد تبين المشكل .

الكود الذي أستعمله : 


كود :
  DataTable tblPrice = new DataTable();
           tblPrice.Clear();

  int countQty = 0;
                   try
                   {
                       countQty = Convert.ToInt32(db.ReadData("select sum (Pro_ID) from Products_Qty where Pro_ID = " + Cbxithem.SelectedValue + "", "").Rows[0][0]);
                   }
                   catch (Exception) { }

tblPrice = db.ReadData("select * from Products_Qty where Pro_ID = " + Cbxithem.SelectedValue + "", "");

string Product_Price = tblPrice.Rows[countQty - 1][4].ToString();


DgvBuy.Rows.Add(1);
                   int rowindex = DgvBuy.Rows.Count - 1;

tblunit = db.ReadData("select * from Products_Unit where Pro_ID = " + DgvBuy.CurrentRow.Cells[0].Value + " and Unit_Name = N'" + DgvBuy.CurrentRow.Cells[2].Value + "'", "");
                   decimal realPrice = 0;
                   try
                   {
                       realPrice = Convert.ToDecimal(Product_Price) / Convert.ToDecimal(tblunit.Rows[0][3]);
                   }
                   catch (Exception) { }
                   decimal total = Convert.ToDecimal(Product_Qty) * Convert.ToDecimal(realPrice);

                   DgvBuy.Rows[rowindex].Cells[4].Value = Math.Round(realPrice, 2);




[صورة مرفقة: attachment.php?aid=22813]

[صورة مرفقة: attachment.php?aid=22814]


الملفات المرفقة صورة/صور
       
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو
#2
هذا استعلام اقل قيمة :

PHP كود :
Select Pro_ID,Store_ID,Store_Name,Qty,Min(Buy_Price)As Buy_Price,Sales_PriceTax From Products_Qty 
الرد }}}
تم الشكر بواسطة: tfarejdz , ابراهيم ايبو
#3
(03-09-19, 02:59 AM)asemshahen5 كتب : هذا استعلام اقل قيمة :

PHP كود :
Select Pro_ID,Store_ID,Store_Name,Qty,Min(Buy_Price)As Buy_Price,Sales_PriceTax From Products_Qty 

الله يحفظك و ينور طريقك ويعطيك ما تتمناه وتريده
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو , asemshahen5
#4
(03-09-19, 11:43 PM)tfarejdz كتب :
(03-09-19, 02:59 AM)asemshahen5 كتب : هذا استعلام اقل قيمة :

PHP كود :
Select Pro_ID,Store_ID,Store_Name,Qty,Min(Buy_Price)As Buy_Price,Sales_PriceTax From Products_Qty 

الله يحفظك و ينور طريقك ويعطيك ما تتمناه وتريده

تم التعديل مع بعض التعديلات والنتائج تظهر ممتازة على الغريدفيو


PHP كود :
int countQty 0;
 
                   try
                    
{
 
                       countQty Convert.ToInt32(db.ReadData("select sum(Pro_ID)As Pro_ID from Products_Qty where Pro_ID = " Cbxithem.SelectedValue " GROUP BY Pro_ID""").Rows[0][0]);
 
                   }
 
                   catch (Exception) { }


 
                   tblPrice db.ReadData("Select Pro_ID,Store_ID,Store_Name,Qty,Min(Buy_Price)As Buy_Price,Sales_PriceTax From Products_Qty where Pro_ID = " Cbxithem.SelectedValue " GROUP BY Pro_ID , Store_ID , Store_Name , Qty , Buy_Price , Sales_PriceTax """);


string Product_ID tblItems.Rows[0][0].ToString();
 
                   string Product_Name tblItems.Rows[0][1].ToString();
 
                   string Product_Qty "1";
 
                   string Product_Price tblPrice.Rows[indexcountQty 0][4].ToString();
 
                   string Product_Unit tblItems.Rows[0][16].ToString();
 
                   decimal Discount 0;


 
                   DgvBuy.Rows.Add(1);
 
                   int rowindex DgvBuy.Rows.Count 1;

 
                   DgvBuy.Rows[rowindex].Cells[0].Value Product_ID;
 
                   DgvBuy.Rows[rowindex].Cells[1].Value Product_Name;
 
                   DgvBuy.Rows[rowindex].Cells[2].Value Product_Unit;
 
                   DgvBuy.Rows[rowindex].Cells[3].Value Product_Qty;
 
                   tblunit db.ReadData("select * from Products_Unit where Pro_ID = " DgvBuy.CurrentRow.Cells[0].Value " and Unit_Name = N'" DgvBuy.CurrentRow.Cells[2].Value "'""");
 
                   decimal realPrice 0;
 
                   try
                    
{
 
                       realPrice Convert.ToDecimal(Product_Price) / Convert.ToDecimal(tblunit.Rows[0][3]);
 
                   }
 
                   catch (Exception) { }
 
                   decimal total Convert.ToDecimal(Product_Qty) * Convert.ToDecimal(realPrice);

 
                   DgvBuy.Rows[rowindex].Cells[4].Value Math.Round(realPrice2);
 
                   DgvBuy.Rows[rowindex].Cells[5].Value Discount;
 
                   DgvBuy.Rows[rowindex].Cells[6].Value Math.Round(total2);
 
               }
 
               catch (Exception) { } 



شكرا جزيلا على المساعدة
الرد }}}
تم الشكر بواسطة: asemshahen5 , ابراهيم ايبو
#5
الحمد الله و الشكر الله .
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  جلب قيمة مدخلة من صفحة ويب bidaya 2 1,498 29-07-22, 05:19 PM
آخر رد: الماجيك مسعد
  استعلام للحصول على اكبر قيمة لكل معرّف issamsaidd 3 1,766 14-06-21, 11:25 PM
آخر رد: anolkay
  استفسار عن كيفية اظهار قيمة في تيكست بوكس بناءا على الاختيار من كومبو بوكس jalalaldeen 0 1,286 11-01-21, 01:03 PM
آخر رد: jalalaldeen
  كيفية عند عدم أختيار اي item من comboBoxيجعل قيمة comboBox تساوي null رياض الحسني 1 1,909 12-12-19, 06:14 PM
آخر رد: asemshahen5
  مساعدة فى الاستعلام من قاعدة البينات لاكثر من جدول issamsaidd 9 2,766 23-11-19, 04:58 PM
آخر رد: asemshahen5
  [C#.NET] جلب قيمة PHPSID من موقع invocker 4 2,027 31-10-19, 03:28 PM
آخر رد: invocker
  جملة استعلام لجلب مجموع قيمة عمود لكل شهر للسنة الحالية. Rabeea Qbaha 4 4,002 24-10-19, 10:37 PM
آخر رد: Rabeea Qbaha
  [تم الحل] مشكلة فى جمع سطر فى جدول مع سطر اخر maxruined 8 2,899 31-08-19, 06:47 PM
آخر رد: asemshahen5
  [تم الحل]مشكلة فى جلب قيمة من داتا جريد فيو maxruined 74 21,045 26-08-19, 07:29 PM
آخر رد: maxruined
  مشكلة فى عرض قيمة من داتا جريد فيو maxruined 34 9,597 09-07-19, 07:55 PM
آخر رد: asemshahen5

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم