كريمو2 قام بنشر يناير 15, 2017 مشاركة قام بنشر يناير 15, 2017 السلام عليكم إخواني ممكن مساعدة بخصوص نهاية فترة تسديد القرض يكون اخر الشهر وليس في اول الشهر مثلا عامل تحصل على قرض مالي بمبلغ 40.000.00 دج مدة الإقتطاع 08 اشهر بداية الإقتطاع من 2017/01/01 الى غاية 2017/08/01 المطلوب يكون : 2017/01/01 الى غاية 2017/08/31 Private Sub UpdateEndData() Dim Dcode As Integer 'since we are using the calendar, we will get the day, month, and year, 'although we only need the month and the year, and that is what this fields Format shows, mmmm\-yyyy 'but for easyness for the search later, we will assign the day always as 1 If Len(Me.AwardMonth & "") <> 0 Then Me.AwardMonth = DateSerial(Year(Me.AwardMonth), Month(Me.AwardMonth), 1) End If Me.DiscountStartDate = DateSerial(Year(Me.DiscountStartDate), Month(Me.DiscountStartDate), 1) Dcode = Switch([Cridi_ID] = 1, 10, [Cridi_ID] = 2, 10, [Cridi_ID] = 3, 10, [Cridi_ID] = 4, 8, [Cridi_ID] = 5, 2) DiscountEndDate = DateAdd("m", Dcode, [DiscountStartDate] - 1) Me.DiscountEndDate = DateSerial(Year(Me.DiscountEndDate), Month(Me.DiscountEndDate), 1) DiscountPerMonth = [Cridi_Value] / Dcode 'add the loan Records to tbl_Loans Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("Select * From tbl_Loans") 'rst.MoveLast: rst.MoveFirst For I = 0 To Me.CmdCridi.Column(4) - 1 rst.AddNew rst!EmployeeID = Me.EmployeeID rst!Loan_ID = Me.ID rst!Loan_AwardMonth = Me.AwardMonth rst!Payment_Month = DateAdd("m", I, Me.DiscountStartDate) 'add the months, or use the next line 'rst!Payment_Month = DateSerial(Year(Me.DiscountStartDate), Month(Me.DiscountStartDate) + I, 1) rst!Loan_Cridi = Me.txtDiscountPerMonth 'rst!Loan_Elec= 'to be used in Elec loan Form 'rst!Loan_Other= 'to be used in Other loan Form 'rst!Payment_Made = 'to be used each time a pyment is made rst!Loan_Type = "Cridi" rst!Remarks = Me.CmdCridi.Column(1) rst.Update Next I rst.Close: Set rst = Nothing txtDiscountPerMonth.Requery txtDiscountEndDate.Requery 'Auto_ID, Auto_Date, EmployeeID, Loan_ID, Loan_AwardMonth, Payment_Month, Loan_Cridi, Loan_Elec, Loan_Other, Payment_Amount, Payment_Made, Remarks 'EmployeeID 'Loan_ID 'Loan_AwardMonth 'Payment_Month' 'Loan_Cridi 'Loan_Elec 'Loan_Other 'Payment_Amount 'Payment_Made 'Remarks End Sub رابط هذا التعليق شارك More sharing options...
كريمو2 قام بنشر يناير 15, 2017 الكاتب مشاركة قام بنشر يناير 15, 2017 للرفع رابط هذا التعليق شارك More sharing options...
jjafferr قام بنشر يناير 15, 2017 مشاركة قام بنشر يناير 15, 2017 وعليكم السلام اخي كريمو بدل هذا السطر Me.DiscountEndDate = DateSerial(Year(Me.DiscountEndDate), Month(Me.DiscountEndDate), 1) استعمل Me.DiscountEndDate = DateSerial(Year(Me.DiscountEndDate), Month(Me.DiscountEndDate), 0) . جعفر رابط هذا التعليق شارك More sharing options...
كريمو2 قام بنشر يناير 15, 2017 الكاتب مشاركة قام بنشر يناير 15, 2017 شكرا استاذي الكريم جعفر التصحيح انقص شهرا مثلا بداية الاقتطاع 2017/01/01 النهاية 2017/08/31 المدة 8 اشهر .................. الصحيح الكود حاليا يعمل الى غاية 2017/07/31 .................. الخطأ رابط هذا التعليق شارك More sharing options...
jjafferr قام بنشر يناير 15, 2017 مشاركة قام بنشر يناير 15, 2017 طيب جرب Me.DiscountEndDate = DateSerial(Year(Me.DiscountEndDate), Month(Me.DiscountEndDate)+1, 0) جعفر 1 رابط هذا التعليق شارك More sharing options...
كريمو2 قام بنشر يناير 16, 2017 الكاتب مشاركة قام بنشر يناير 16, 2017 وهو كذالك استاذي الكريم جعفر ... رابط هذا التعليق شارك More sharing options...
الردود الموصى بها
من فضلك سجل دخول لتتمكن من التعليق
ستتمكن من اضافه تعليقات بعد التسجيل
سجل دخولك الان