اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

ازاي اثبت عدد ايام الشهرعلى 30يوم فقط


baraa2007

الردود الموصى بها

السلام عليكم 

 

لو طرحت تاريخين من بعض مثل

18/07/2017  - 16/09/2017   = 60 يوم

علي اساس ان شهر 7 & 8 31 يوم

طب لو عايز اثبت عدد ايام الاشهر الى 30 يوم بس ايا كان الشهر

بحيث يبقا الناتج 58 يوم

اعمل ايه ؟؟؟؟

 

رابط هذا التعليق
شارك

السلام عليكم

 

بعد البحث ، اتضح ان هذه طريقة يستخدمها بعض المحاسبين والتي تسمى 30/360 :smile:

 

ضع الكود في وحدة نمطية:

Public Function Set_30(Date1 As Date, Date2 As Date) As Integer

'
' The basic 30/360 calculation
' From
' https://sqlsunday.com/2014/08/17/30-360-day-count-convention/
' 360*(@y2-@y1) + 30*(@m2-@m1) + (@d2-@d1)
'
' converted to VBA by jjafferr on 20/12/2017
'

    Dim D1 As Integer
    Dim D2 As Integer
    Dim M1 As Integer
    Dim M2 As Integer
    Dim Y1 As Integer
    Dim Y2 As Integer
    
    D1 = DatePart("d", Date1)
    D2 = DatePart("d", Date2)
    
    M1 = DatePart("m", Date1)
    M2 = DatePart("m", Date2)
    
    Y1 = DatePart("yyyy", Date1)
    Y2 = DatePart("yyyy", Date2)
    
    Set_30 = 360 * (Y2 - Y1) + 30 * (M2 - M1) + (D2 - D1)
    
End Function

.

ثم في الاستعلام ، ننادي الوحدة النمطية هكذا:

Number_of_Days: Set_30([Start date],[End Date])

 

جعفر

  • Like 2
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information