اذهب إلى المحتوى

ايمن ميلاد

الأعضاء
  • المساهمات

    390
  • تاريخ الانضمام

  • تاريخ آخر زيارة

  • عدد الأيام التي تصدر بها

    1

كل منشورات العضو ايمن ميلاد

  1. لازالت نفس مشكلة <?php use App\Http\Controllers\DepartmentController; use Illuminate\Support\Facades\Route; Route::get('/', function () { return view('welcome'); })->name('/'); Route::get('/Department', [DepartmentController::class, 'index'])->name('Department'); Route::get('Department/create', [DepartmentController::class, 'create']); Route::get('Department/{id}', [DepartmentController::class, 'show']); Route::post('Department', [DepartmentController::class, 'store']); Route::get('Department/{id}/edit', [DepartmentController::class, 'edit']); Route::put('Department/{id}', [DepartmentController::class, 'update']); Route::delete('Department/{id}', [DepartmentController::class, 'destroy']); للعلم مجلد وداخله صفحة index <?php namespace App\Http\Controllers; use App\Models\Department; use Illuminate\Http\Request; class DepartmentController extends Controller { public function index() { $departments = Department::all(); return view('department.index', compact('departments')); } public function show() {} public function create() { return view('department.create'); } public function store(Request $request) { $department = new Department(); $department->Name_dept = $request->input('name'); $department->save(); return redirect()->route('Department.index'); } public function edit($id) { return view('department.edit'); } public function update($id) {} public function destroy($id) {} } @extends('layouts.master') @section('title') الاقسام @stop @section('css') <style> .form-group { display: flex; flex-direction: column; align-items: center; margin-top: 20px; } #name { width: 50%; } </style> @stop @section('title_page1') الاقسام @stop @section('title_page2') اضافة قسم @stop @section('content') <form action="/Department" method="post"> @csrf <div class="form-group"> <label for="name">اسم القسم</label> <input type="text" name="name" id="name" class="form-control"> </div> <div class="form-group"> <button class="btn btn-primary">حفظ</button> </div> </form> @stop @section('scripts') @stop
  2. لازالت تظهر مشكلة <?php use App\Http\Controllers\DepartmentController; use Illuminate\Support\Facades\Route; Route::get('/', function () { return view('welcome'); })->name('/'); Route::get('/Department', [DepartmentController::class, 'index'])->name('Department'); Route::get('Department/create', [DepartmentController::class, 'create']); Route::get('Department/{id}', [DepartmentController::class, 'show']); Route::post('Department', [DepartmentController::class, 'store']); Route::get('Department/{id}/edit', [DepartmentController::class, 'edit']); Route::put('Department/{id}', [DepartmentController::class, 'update']); Route::delete('Department/{id}', [DepartmentController::class, 'destroy']); <?php namespace App\Http\Controllers; use App\Models\Department; use Illuminate\Http\Request; class DepartmentController extends Controller { public function index() { $departments = Department::all(); $deptcount=Department::count(); return view('department.index', compact('departments','deptcount')); } public function show() {} public function create() { return view('department.create'); } public function store(Request $request) { $department = new Department(); $department->Name_dept = $request->input('name'); $department->save(); return redirect()->route('Departments.index'); } public function edit($id) { return view('department.edit'); } public function update($id) {} public function destroy($id) {} } @extends('layouts.master') @section('title') الاقسام @stop @section('css') <style> .form-group { display: flex; flex-direction: column; align-items: center; margin-top: 20px; } #name { width: 50%; } </style> @stop @section('title_page1') الاقسام @stop @section('title_page2') اضافة قسم @stop @section('content') <form action="/Department" method="post"> @csrf <div class="form-group"> <label for="name">اسم القسم</label> <input type="text" name="name" id="name" class="form-control"> </div> <div class="form-group"> <button class="btn btn-primary">حفظ</button> </div> </form> @stop @section('scripts') @stop
  3. لماذا عندما ازور صفحة تظهر Page Expired @extends('layouts.master') @section('title') الاقسام @stop @section('css') <head> <meta name="csrf-token" content="{{csrf_token()}}"> </head> <style> .form-group { display: flex; flex-direction: column; align-items: center; margin-top: } #name { width: 50%; } </style> @stop @section('title_page1') الاقسام @stop @section('title_page2') اضافة قسم @stop @section('content') <form action="/Department" method="post"> <input type="hidden" name="_token" value="{{csrf_token()}}"> <div class="form-group"> <label for="name">اسم القسم</label> <input type="text" name="name" id="name" class="form-control"> </div> <div class="form-group"> <button class="btn btn-primary">حفظ</button> </div> </form> @stop @section('scripts') @stop public function store(Request $request) { $department = new Department(); $department->Name_dept = $request->input('name'); $department->save(); return redirect(); } ممكن حل مشكلة
  4. السلام عليكم لدي مشكلة اثناء زيارة صفحة تظهر فارغة Route::get('Department', [DepartmentController::class, 'index'])->name('Department'); Route::get('Department/create', [DepartmentController::class, 'create']); Route::get('Department/{id}', [DepartmentController::class, 'show']); Route::post('Department', [DepartmentController::class, 'store']); Route::get('Department/{id}/edit', [DepartmentController::class, 'edit']); Route::put('Department/{id}',[DepartmentController::class, 'update']); Route::delete('Department/{id}',[DepartmentController::class, 'destroy']); كود صفحة index @extends('layouts.master'); @section('title') الاقسام @stop @section('css') @stop @section('title_page1') لوحة التحكم @stop @section('title_page2') الأقسام @stop @section('content') <div class="box"> <div class="box-header"> <h4> <a href="/department/create">إضافة قسم</a></h4> </div> <!-- /.box-header --> <div class="box-body no-padding"> <table class="table direction table-striped"> <th>#</th> <th>اسم القسم</th> <th>تاريخ الانشاء</th> @foreach ($departments as $index => $department) <tr> <td>{{ $department->id_dept }}</td> {{-- <td>{{ $department->Name_dept }}</td> --}} <td><a href="/department/<?=$department->id_dept ?>"><?=$department->Name_dept ?></a></td> <td>{{ $department->created_at }}</td> </tr> @endforeach </table> </div> <!-- /.box-body --> </div> @endsection @section('scripts') @stop دوال داخل controller <?php namespace App\Http\Controllers; use App\Models\Department; use Illuminate\Http\Request; class DepartmentController extends Controller { public function index() { $departments = Department::all(); return view('department.index', compact('departments')); } public function show() { } public function create() { return view ('department.create'); } public function store() { } public function edit($id) { return view ('department.edit'); } public function update($id) { } public function destroy($id) { } } صفحة create @extends('layouts.master'); @section('title') الاقسام @stop @section('css') @stop @section('title_page1') الاقسام @stop @section('title_page2') اضافة قسم @stop @section('content') <form action="/Department" method="post"> <div class="form-group"> <label for="name">اسم القسم</label> <input type="text" name="name" id="name" class="form-control"> </div> <div class="form-group"> <button class="btn btn-primary">حفظ</button> </div> </form> @stop @section('scripts') @stop لماذا عندما ازور صفحة create يظهر 404
  5. لماذا اثناء تحديث فاتورة يضيف اعمدة جديدة في داتا قريد فيو كما موضح في صورة ولا يضفيه اسفل عناصر مرفق كود if (e.KeyCode == Keys.Enter) { // التحقق من وجود الصنف مسبقًا for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { if (dataGridView1.Rows[i].Cells[0].Value.ToString()==itemcode.Text ) { MessageBox.Show("اسم الصنف موجود مسبقا", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } CalculateTotal(); // التحقق مما إذا كانت الأعمدة موجودة بالفعل قبل إضافتها // التأكد من أن الجدول يحتوي على الأعمدة المطلوبة if (!dt.Columns.Contains("رقم الصنف")) { dt.Columns.Add("رقم الصنف"); } if (!dt.Columns.Contains("اسم الصنف")) { dt.Columns.Add("اسم الصنف"); } if (!dt.Columns.Contains("السعر")) { dt.Columns.Add("السعر"); } if (!dt.Columns.Contains("الكمية")) { dt.Columns.Add("الكمية"); } if (!dt.Columns.Contains("الاجمالي")) { dt.Columns.Add("الاجمالي"); } // إنشاء صف جديد وإضافة البيانات DataRow r = dt.NewRow(); r["رقم الصنف"] = itemcode.Text; r["اسم الصنف"] = itemname.Text; r["السعر"] = price.Text; r["الكمية"] = qty.Text; r["الاجمالي"] = total_.Text; dt.Rows.Add(r); dataGridView1.DataSource = dt; }
  6. مشكلة تكمن عند تعديل فاتورة بحيث اضيف صنف جديد يظهر اعمدة جديده في داتا قريد فيو معا اعمدة التي به اصناف سابقة if (e.KeyCode == Keys.Enter) { // التحقق من وجود الصنف مسبقًا for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { if (itemcode.Text == dataGridView1.Rows[i].Cells[0].Value.ToString()) { MessageBox.Show("اسم الصنف موجود مسبقا", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } CalculateTotal(); // التحقق مما إذا كانت الأعمدة موجودة بالفعل قبل إضافتها // التأكد من أن الجدول يحتوي على الأعمدة المطلوبة if (!dt.Columns.Contains("رقم الصنف")) { dt.Columns.Add("رقم الصنف"); } if (!dt.Columns.Contains("اسم الصنف")) { dt.Columns.Add("اسم الصنف"); } if (!dt.Columns.Contains("السعر")) { dt.Columns.Add("السعر"); } if (!dt.Columns.Contains("الكمية")) { dt.Columns.Add("الكمية"); } if (!dt.Columns.Contains("الاجمالي")) { dt.Columns.Add("الاجمالي"); } // إنشاء صف جديد وإضافة البيانات DataRow r = dt.NewRow(); r["رقم الصنف"] = itemcode.Text; r["اسم الصنف"] = itemname.Text; r["السعر"] = price.Text; r["الكمية"] = qty.Text; r["الاجمالي"] = total_.Text; dt.Rows.Add(r); dataGridView1.DataSource = dt;
  7. السلام عليكم لدي كود تالي لتعديل بيانات في جدول فاتورة وتفاصيل فاتورة يتم تعديل بيانات في جدول فاتورة لكن تفاصيل فاتورة تظل اصناف كم هيا try { // تعريف المتغير للحصول على اسم المحل من عنصر التحكم string importerName = IMPORTERNAME.Text; // جملة الاستعلام باستخدام معلمة بدلاً من القيمة الثابتة string query = "SELECT IMPORTERNAME, SUM(DebtAmount) AS TotalDebt " + "FROM BUYBILL " + "WHERE IMPORTERNAME = @importerName AND DebtAmount > 0 " + "GROUP BY IMPORTERNAME"; // إنشاء SqlDataAdapter مع جملة الاستعلام والاتصال بقاعدة البيانات SqlDataAdapter a = new SqlDataAdapter(query, Class1.con); // إضافة المعلمة إلى SqlDataAdapter a.SelectCommand.Parameters.AddWithValue("@importerName", importerName); // إنشاء DataTable لملء البيانات المسترجعة DataTable d = new DataTable(); // ملء DataTable باستخدام SqlDataAdapter a.Fill(d); // عرض معلومات الدين if (d.Rows.Count > 0) { string tt = d.Rows[0]["TotalDebt"].ToString(); MessageBox.Show("دين المحل: " + tt); } // التحقق من اختيارات المستخدم if (IMPORTERNAME.SelectedIndex < 0) { MessageBox.Show("يرجى اختيار اسم الزبون", "تنبيه"); IMPORTERNAME.Select(); return; } if (BUYTYPE.SelectedIndex < 0) { MessageBox.Show("يرجى اختيار نوع الفاتورة", "تنبيه"); BUYTYPE.Select(); return; } if (dataGridView1.Rows.Count == 0) { MessageBox.Show("لا توجد أصناف لحفظها", "تنبيه"); return; } // التحقق من وجود الفاتورة DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM buybill WHERE buycode=@buycode", Class1.con); adp.SelectCommand.Parameters.AddWithValue("@buycode", BUYCODE.Text); adp.Fill(dt); if (dt.Rows.Count > 0) { // تحديث بيانات الفاتورة DataRow existingRow = dt.Rows[0]; existingRow["BUYTYPE"] = BUYTYPE.Text; existingRow["IMPORTERNAME"] = IMPORTERNAME.Text; existingRow["NOTES"] = NOTES.Text; existingRow["BUYDATE"] = BUYDATE.Value; existingRow["TOTAL"] = Convert.ToDecimal(total_.Text); existingRow["TOTAL_ARBIC"] = totalar.Text; existingRow["TOTALQTY"] = Convert.ToInt32(totalqty.Text); existingRow["DebtAmount"] = Convert.ToDecimal(total_.Text); SqlCommandBuilder save = new SqlCommandBuilder(adp); adp.Update(dt); // تحديث تفاصيل الفاتورة DataTable dtDetails = new DataTable(); SqlDataAdapter detailAdp = new SqlDataAdapter("SELECT * FROM BUY_DET WHERE BUYCODE=@buycode", Class1.con); detailAdp.SelectCommand.Parameters.AddWithValue("@buycode", BUYCODE.Text); detailAdp.Fill(dtDetails); // تحديث أو إضافة تفاصيل جديدة foreach (DataGridViewRow row in dataGridView1.Rows) { string itemCode = row.Cells[0].Value.ToString(); int qty = Convert.ToInt32(row.Cells[3].Value); // تحقق مما إذا كان العنصر موجود بالفعل في تفاصيل الفاتورة DataRow existingDetail = dtDetails.AsEnumerable() .FirstOrDefault(r => r.Field<string>("ITEMCODE") == itemCode); if (existingDetail != null) { // تحديث الكمية والسعر existingDetail["QTY"] = qty; existingDetail["PRICE"] = row.Cells[2].Value; existingDetail["TOTAL"] = Convert.ToDecimal(row.Cells[2].Value) * qty; } else { // إضافة تفاصيل جديدة DataRow newDetailRow = dtDetails.NewRow(); newDetailRow["BUYCODE"] = BUYCODE.Text; newDetailRow["ITEMCODE"] = itemCode; newDetailRow["ITEMNAME"] = row.Cells[1].Value; newDetailRow["PRICE"] = row.Cells[2].Value; newDetailRow["QTY"] = qty; newDetailRow["TOTAL"] = Convert.ToDecimal(row.Cells[2].Value) * qty; dtDetails.Rows.Add(newDetailRow); } UpdateItemQuantity(itemCode, qty); } SqlCommandBuilder detailCmd = new SqlCommandBuilder(detailAdp); detailAdp.Update(dtDetails); MessageBox.Show("تم تعديل بيانات الفاتورة بنجاح وتحديث كمية في المخزن", "رسالة تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Information); button1_Click(null, null); } } catch (Exception ex) { MessageBox.Show(ex.Message); }
  8. ظهرت البيانات الان لماذا عندما اعدل فاتورة لكي اضيف صنف جديد لها يتم اضافة اعمدة جديدة لداتا قريد فيو try { // تعريف المتغير للحصول على اسم المحل من عنصر التحكم DialogResult result = MessageBox.Show("هل أنت متأكد من أنك تريد تعديل البيانات؟", "تأكيد التعديل", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if ((result == DialogResult.Yes)) { if (BUYTYPE.SelectedIndex < 0) { MessageBox.Show("يرجي اختيار نوع الفاتورة", "تنبيه"); BUYTYPE.Select(); return; } if (dataGridView1.Rows.Count == 0) { MessageBox.Show("لاتوجد أصناف لتعدليها ", "تنبيه"); return; } DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter("select *from buybill where buycode='" + BUYCODE.Text + "'", Class1.con); adp.Fill(dt); if (dt.Rows.Count == 0) { int code = Class1.CODE_GENE("BUYBILL", "ID") + 1; BUYCODE.Text = code.ToString(); } else { DataRow dr = dt.Rows[0]; dr["BUYCODE"] = BUYCODE.Text; dr["BUYTYPE"] = BUYTYPE.Text; dr["IMPORTERNAME"] = IMPORTERNAME.Text; dr["NOTES"] = NOTES.Text; dr["BUYDATE"] = BUYDATE.Value; dr["TOTAL"] = Convert.ToDecimal(total_.Text); dr["TOTAL_ARBIC"] = totalar.Text; dr["TOTALQTY"] = Convert.ToInt32(totalqty.Text); dr["DebtAmount"] = Convert.ToDecimal(total_.Text); dt.Rows.Add(dr); SqlCommandBuilder save = new SqlCommandBuilder(adp); adp.Update(dt); SqlCommand cmd_del = new SqlCommand(); cmd_del.Connection = Class1.con; cmd_del.CommandText = "DELETE FROM BUY_DET WHERE BUYCODE ='" + BUYCODE.Text + "'"; cmd_del.ExecuteNonQuery(); DataTable dtDetails = new DataTable(); adp = new SqlDataAdapter("SELECT *FROM BUY_DET", Class1.con); adp.Fill(dtDetails); if (dataGridView1.Columns.Count == 0) { dataGridView1.Columns.Add("ITEMCODE", "كود الصنف"); dataGridView1.Columns.Add("ITEMNAME", "اسم الصنف"); dataGridView1.Columns.Add("PRICE", "السعر"); dataGridView1.Columns.Add("QTY", "الكمية"); dataGridView1.Columns.Add("TOTAL", "الإجمالي"); } dataGridView1.Rows.Clear(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { DataRow dr_ = dtDetails.NewRow(); dr_["BUYCODE"] = BUYCODE.Text; dr_["ITEMCODE"] = dataGridView1.Rows[i].Cells[0].Value; dr_["ITEMNAME"] = dataGridView1.Rows[i].Cells[1].Value; dr_["PRICE"] = dataGridView1.Rows[i].Cells[2].Value; //dr_["TOTAL"] = total_.Text; dr_["QTY"] = dataGridView1.Rows[i].Cells[3].Value; dtDetails.Rows.Add(dr_); dr_["TOTAL"] = Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value) * Convert.ToDecimal(dataGridView1.Rows[i].Cells[3].Value); string itemCode = dataGridView1.Rows[i].Cells[0].Value.ToString(); int qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); UpdateItemQuantity(itemCode, qty); } SqlCommandBuilder cmd_ = new SqlCommandBuilder(adp); adp.Update(dtDetails); MessageBox.Show(" تم حفظ تعديل بيانات فاتورة بنجاح وتحديث كمية في المخزن ", "رسالة تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Information); button1_Click(null, null); } } } catch (Exception ex) { MessageBox.Show(ex.Message); }
  9. السلام عليكم لدي كود عرض بيانات فاتورة وتفاصيل الفاتورة لماذا لا يتم عرض بيانات public void show_details(string id) { try { // إنشاء DataTable وملء البيانات باستخدام SqlDataAdapter string sql = "SELECT * FROM BUYBILL WHERE BUYCODE = '" + (id)+ "'"; DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter(sql, Class1.con); adp.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("يرجى التأكد من رقم الفاتورة", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataRow row = dt.Rows[0]; BUYCODE.Text = row["BUYCODE"].ToString(); BUYTYPE.Text = row["BUYTYPE"].ToString(); IMPORTERNAME.Text = row["IMPORTERNAME"].ToString(); if (row["BUYDATE"] != DBNull.Value) BUYDATE.Value = DateTime.Parse(row["BUYDATE"].ToString()).Date; NOTES.Text = row["NOTES"].ToString(); total_.Text = row["TOTAL"].ToString(); totalqty.Text = row["TOTALQTY"].ToString(); DataTable dt_ = new DataTable(); string sql_ = "SELECT * FROM BUY_DET WHERE BUYCODE = N'" + (id) + "'"; SqlDataAdapter adp_ = new SqlDataAdapter(sql_, Class1.con); adp_.Fill(dt_); // إضافة أعمدة إلى DataGridView إذا لم تكن موجودة بالفعل if (dataGridView1.Columns.Count == 0) { dataGridView1.Columns.Add("ITEMCODE", "كود الصنف"); dataGridView1.Columns.Add("ITEMNAME", "اسم الصنف"); dataGridView1.Columns.Add("PRICE", "السعر"); dataGridView1.Columns.Add("QTY", "الكمية"); dataGridView1.Columns.Add("TOTAL", "الإجمالي"); } dataGridView1.Rows.Clear(); foreach (DataRow detailRow in dt_.Rows) { dataGridView1.Rows.Add(detailRow["ITEMCODE"], detailRow["ITEMNAME"], detailRow["PRICE"], detailRow["QTY"], detailRow["TOTAL"]); } btn_edit.Enabled = true; btn_save.Enabled = false; } } catch (Exception ex) { MessageBox.Show("حدث خطأ: " + ex.Message, "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error); } كود استدعاء دالة BUYBILL frm = new BUYBILL(); frm.show_details(dataGridView1.CurrentRow.Cells[1].Value.ToString()); this.Close();
  10. تم حل مشكلة عن طريق عمل command داخل كريستال ريبورت
  11. هادي جملة استعلام تعرض بدون تكرار داخل sql server SELECT DISTINCT dbo.BUYBILL.BUYCODE, dbo.BUYBILL.BUYTYPE, dbo.BUYBILL.BUYDATE, dbo.BUYBILL.IMPORTERNAME, dbo.BUYBILL.NOTES,dbo.BUY_DET.ITEMNAME,dbo.BUY_DET.PRICE ,dbo.BUY_DET.QTY,dbo.BUY_DET.TOTAL, dbo.BUYBILL.TOTAL FROM dbo.BUYBILL INNER JOIN dbo.BUY_DET ON dbo.BUYBILL.BUYCODE = dbo.BUY_DET.BUYCODE; مشكلة تكمن عند حفظ فاتورة وانشاء فاتورة جديدة يجلب بيانات تبع فاتورة سابقة معا جديدة في تقرير بمعني اشتريت بظاعة وبضاعة الي قبلي انا اريد اخر فاتورة وعرضها باصنافها فقط هادي جملة استعلام التي استعمله لماذا يعرض اصناف فاتورة سابقة معاه اصناف فاتورة حالية واصناف فاتورة حالية وسابقة SELECT dbo.BUYBILL.BUYCODE, dbo.BUYBILL.BUYTYPE, dbo.BUYBILL.BUYDATE, dbo.BUYBILL.IMPORTERNAME, dbo.BUYBILL.NOTES, dbo.BUY_DET.ITEMNAME, dbo.BUY_DET.PRICE, dbo.BUY_DET.QTY, dbo.BUY_DET.TOTAL, dbo.BUYBILL.TOTAL FROM dbo.BUYBILL INNER JOIN dbo.BUY_DET ON dbo.BUYBILL.BUYCODE = dbo.BUY_DET.BUYCODE WHERE dbo.BUYBILL.BUYCODE = (SELECT MAX(BUYCODE) FROM dbo.BUYBILL);
  12. السلام عليكم لدي جملة استعلام تالية تعرض بيانات بدون تكرار لماذا في كريستال ريبورت تعرض أكثر من مرة بتكرار SELECT dbo.BUYBILL.BUYCODE, dbo.BUYBILL.BUYTYPE, dbo.BUYBILL.BUYDATE, dbo.BUYBILL.IMPORTERNAME, dbo.BUYBILL.NOTES, dbo.BUYBILL.TOTAL, dbo.BUY_DET.ITEMCODE, dbo.BUY_DET.ITEMNAME, dbo.BUY_DET.PRICE, dbo.BUY_DET.QTY, dbo.BUY_DET.TOTAL AS Expr1 FROM dbo.BUYBILL INNER JOIN dbo.BUY_DET ON dbo.BUYBILL.BUYCODE = dbo.BUY_DET.BUYCODE; رغم انه فعلت خيار Suppress If Duplicated وقم بوضع علامة بجانبه. لزالت تظهر مشكلة يتكرر سطر ثلاثة مرات لكنه فارغ فقط ما الحل سبب انه datagridview تجلب منتجات اخر فاتورة void createdatatable() { dt.Columns.Add("رقم الصنف"); dt.Columns.Add("اسم الصنف"); dt.Columns.Add("سعر الشراء"); dt.Columns.Add("الكمية "); dt.Columns.Add(" الاجمالي"); dataGridView1.DataSource = dt; } try { if (IMPORTERNAME.SelectedIndex < 0) { MessageBox.Show("يرجي اختيار اسم الزبون", "تنبيه"); IMPORTERNAME.Select(); return; } if (BUYTYPE.SelectedIndex < 0) { MessageBox.Show("يرجي اختيار نوع الفاتورة", "تنبيه"); BUYTYPE.Select(); return; } if (dataGridView1.Rows.Count == 0) { MessageBox.Show("لاتوجد أصناف لحفظها", "تنبيه"); return; } DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter("select *from buybill where buycode='" + BUYCODE.Text + "'", Class1.con); adp.Fill(dt); if (dt.Rows.Count > 0) { int code = Class1.CODE_GENE("BUYBILL", "ID") + 1; BUYCODE.Text = code.ToString(); } else { DataRow dr = dt.NewRow(); dr["BUYCODE"] = BUYCODE.Text; dr["BUYTYPE"] = BUYTYPE.Text; dr["IMPORTERNAME"] = IMPORTERNAME.Text; dr["NOTES"] = NOTES.Text; dr["BUYDATE"] = BUYDATE.Value; dr["TOTAL"] = Convert.ToDecimal(total_.Text); dr["TOTAL_ARBIC"] = totalar.Text; dr["TOTALQTY"] = Convert.ToInt32( totalqty.Text); dt.Rows.Add(dr); SqlCommandBuilder save = new SqlCommandBuilder(adp); adp.Update(dt); adp = new SqlDataAdapter("SELECT *FROM BUY_DET", Class1.con); adp.Fill(dt); for(int i=0;i<dataGridView1.Rows.Count;i++) { DataRow dr_ = dt.NewRow(); dr_["BUYCODE"]= BUYCODE.Text; dr_["ITEMCODE"] = dataGridView1.Rows[i].Cells[0].Value; dr_["ITEMNAME"] = dataGridView1.Rows[i].Cells[1].Value; dr_["PRICE"]= dataGridView1.Rows[i].Cells[2].Value; dr_["TOTAL"] = total_.Text; dr_["QTY"] = dataGridView1.Rows[i].Cells[3].Value; dt.Rows.Add(dr_); SqlCommandBuilder cmd_ = new SqlCommandBuilder(adp); adp.Update(dt); string itemCode = dataGridView1.Rows[i].Cells[0].Value.ToString(); int qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value); UpdateItemQuantity(itemCode, qty); } MessageBox.Show(" تم حفظ بيانات فاتورة بنجاح وتحديث كمية في المخزن ", "رسالة تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView1.DataSource = ""; button1_Click(null, null); } } catch(Exception ex) { MessageBox.Show(ex.Message); } كود حفظ وتعبئة داتا قريد فيو
  13. تم تغير بنجاح لدي تقرير من اسفل الصفحة واحد من اثنين كيف اجعله بالعربي
  14. لازالت نفس مشكلة string sql = "select *from items"; DataSet ds = new DataSet(); SqlDataAdapter adp = new SqlDataAdapter(sql, Class1.con); adp.Fill(ds); DataTable dt; dt = ds.Tables[0]; if(dt.Rows.Count==0) { MessageBox.Show("لايوجد بيانات لعرضها في التقرير"); return; } else { CrystalReport3 rept = new CrystalReport3(); foreach(DataRow row in dt.Rows) { row["ExpiryDate"] = ((DateTime)row["ExpiryDate"]).ToString("yyyy-MM-dd"); } rept.SetDataSource(dt); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "PDF Files|*.pdf"; saveFileDialog.Title = "حفظ التقرير كملف PDF"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { // حفظ التقرير كملف PDF string exportPath = saveFileDialog.FileName; ExportToPDF(rept, exportPath); } printpreview frm = new printpreview(); frm.crystalReportViewer1.ReportSource = rept; frm.ShowDialog(); حقل من نوع date في قاعدة بيانات sql
  15. مرحبا إخوتي .. لدي جدول يحتوي حقل التاريخ .. التاريخ فقط بدون ساعة .. نوعه date عندما أقوم بنقل التاريخ إلى تقرير كريستال ريبورت بواسطة dataset عبر جملة sql .. يظهر في التقرير تاريخ وساعة مضبوطة على 12 صباحا .. علما بأن التاريخ في الحقل في sql server تاريخ فقط بدون ساعة .. اريد إظهاره في التقرير بدون ساعة .. string sql = "select *from items"; DataSet ds = new DataSet(); SqlDataAdapter adp = new SqlDataAdapter(sql, Class1.con); adp.Fill(ds); DataTable dt; dt = ds.Tables[0]; if(dt.Rows.Count==0) { MessageBox.Show("لايوجد بيانات لعرضها في التقرير"); return; } else { CrystalReport3 rept = new CrystalReport3(); rept.SetDataSource(dt); printpreview frm = new printpreview(); frm.crystalReportViewer1.ReportSource = rept; frm.ShowDialog(); }
  16. السلام عليكم استخدم winform سي شارب لدي ورقة مكتوب به كلام مثلا اسم الطالب امامه فراغ عنوانه ام فارغه رقم هاتف امامه فراغ اريد انا اكتب عن طريق textbox يظهر كلام كل شي امامه كل كلمة بالضبط ممكن مثال او طريقة علي دلك استعمل كريستال ريبورت للتقرير علما بان الورقة عرضه 320.0 وطوله 210 كيف حل
  17. لازالت مشكلة نفسه بعد اغلاق laragon عملت امر php --ini في cmd
  18. انا استخدم laragon هل اغير default value موجوده قيمه جربت غيرت منفد من خلال امر php artisan serve --port=8008 لازالت نفس مشكلة
  19. السلام عليكم عند تشغيل مشروع لارافيل عبر امر تالي php artisan serve تظهر مشكلة التي في صورة ما الحل
  20. كيفية اظهار تنبيه في حالة رقم القيد او ايميل ورقم هاتف مكرر بمعني تم ادخاله من جديد وكيف اظهار رسالة تم حفظ لماذا لم تظهر بارك الله فيك علي الرد
  21. السلام عليكم ممكن تعديل علي كود حفظ بيانات الطالب التالي بحيث جعل عند ترك كل حقول فارغه يظهر تنبيه اسفل حقل وممكن كود لحفظ صورة يكون داخل مجلد وكيفية جعل input رقم القيد يقبل ارقام فقط انا لدي مفتاج اجنبي رقم قسم في جدول طالب كيف اتعامل معاه اثناء حفظ البيانات public function store(Request $request) { $request->validate([ 'name_std' => 'required|string|max:180', 'num_std' => 'required|max:180', 'image' => 'image', ]); $student = new student(); $student->name_std = $request->input('name_std'); $student->num_std = $request->input('num_std'); $student->email_std = $request->input('email_std'); $student->date_student = $request->input('date_student'); $student->adress_std = $request->input('adress_std'); $student->phone = $request->input('phone'); $student->gender = $request->input('gender'); $student->id_dept = $request->input('id_dept'); // حفظ id_dept $student->save(); return redirect('/student'); }
  22. ما حل مشكلة
  23. لماذا لم يعمل php artisan make:migration add_department_id_to_students_table --table=students class student extends Model { use HasFactory; protected $fillable = ['name_std', 'num_std', 'email_std', 'date_student', 'adress_std', 'phone', 'gender', 'image']; public function department() { return $this->belongsTo(Department::class); } } class Department extends Model { use HasFactory; public function students() { return $this->hasMany(Student::class); } } public function up(): void { Schema::table('students', function (Blueprint $table) { // $table->foreignId('department_id')->constrained()->after('name')->onDelete('cascade'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('students', function (Blueprint $table) { // $table->dropForeign(['department_id']); $table->dropColumn('department_id'); }); }
×
×
  • أضف...