Engine Code
Engine Code
SQLite
Imports System.Drawing.Drawing2D
Imports NCalc
Me.DoubleBuffered = True
' إعدادTimer
updateTimer.Interval = 3000 ' 3 ثواني
updateTimer.Start() ' بدء التحديث التلقائي
TextPrice.Text = My.Settings.PricePerAmpere.ToString()
End Sub
Private Sub updateTimer_Tick(sender As Object, e As EventArgs) Handles
updateTimer.Tick
UpdateCurrentAmperes()
LoadPaymentStatistics()
LoadActions()
LoadExpenses()
End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize
' )إعادة رسم الفورم عند تغيير الحجم (للدائرة والنص
Me.Invalidate()
End Sub
' )حساب عدد الدافعين للشهر الحالي (عدد المشتركين الذين دفعوا
Dim paidCount As Integer
Dim queryPaidCount As String = "SELECT COUNT(DISTINCT SubscriberName)
FROM Payments WHERE IsPaid = 1 AND strftime('%Y-%m', PaymentDate) = @monthYear"
' حساب المبلغ المستحق بناًء على الأمبيرات والسعر لكل أمبير
Dim amountDue As Decimal = totalAmperes * pricePerAmpere
Guna2TextBox4.Text = amountDue.ToString("N0") ' تنسيق رقم المبلغ
If Convert.ToInt32(cmd.ExecuteScalar()) = 0 Then
' إذا،هنا يمكنك إعادة تعيين المصروفات أو القيام بأي إجراء آخر
لزم الأمر.
End If
End Using
End Using
End Sub
Dim daysInMonth =
DateTime.DaysInMonth(currentYear,
currentMonth)
Const cellWidth =
45
Const cellHeight =
45
Const startXOffset =
15
Const startYOffset =
65
For dayIndex =
1 To daysInMonth
Dim rowIndex =
(dayIndex + startDayOfWeekAsInt - 1) \ 7
Dim xPos =
startXOffset + columnIndex * cellWidth
Dim yPos =
startYOffset + rowIndex * cellHeight
g.FillRectangle(Brushes.LightBlue,
xPos,
yPos,
cellWidth,
cellHeight)
End If
g.DrawRectangle(Pens.Black,
xPos,
yPos,
cellWidth,
cellHeight)
g.DrawString(dayIndex.ToString(),
New Font("Arial",
12),
Brushes.Black,
xPos + cellWidth / 3,
yPos + cellHeight / 3)
Next
Dim daysOfWeek() =
{""الأحد,
""الإثنين,
""الثالثاء,
""الأربعاء,
""الخميس,
""الجمعة,
"}"السبت
For iDayNameIndex =
0 To daysOfWeek.Length - 1
g.DrawString(daysOfWeek(iDayNameIndex),
New Font("Arial",
10,
FontStyle.Bold),
Brushes.Black,
startXOffset + iDayNameIndex * cellWidth + cellWidth \ 5,
startYOffset - 25)
Next
End Sub
End Sub
End Sub
Try
Guna2TextBox8.Text =
result.ToString()
expression =
result.ToString()
Catch ex As Exception
End Try
End Sub
End Class