Process Modules Project

Process Modules Project source code and complete project in "Process Modules and ProcessName Collecter" e-learning section.
Coded by: Wesam Naffaa

Puzzle Game project

Full Puzzle Game source code and complete project in "Puzzle Game project" e-learning section.
NOTE: You must read "Puzzle Game - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

Accounting Manager project

Full Accounting manager source code and complete project in "Universal Accounting Manager project" e-learning section.
NOTE: You must read "Universal Accounting Manager - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

File encryption project

Full File encryption center source code and complete project in "File encryption center project" e-learning section.
NOTE: You must read "File encryption center - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

Universal Accounting Manager - NewSell.vb

NewSell.vb
  1. Public Class NewSell
  2.     Dim ProgramName As String = My.Application.Info.AssemblyName
  3.     Dim DataPath As String = System.Environment.CurrentDirectory & "\UAM"
  4.     Dim ProductPath As String = DataPath & "\Products" '
  5.     Dim ServicesPath As String = DataPath & "\Services"
  6.     Dim CatPath As String = DataPath & "\Categories"
  7.     Dim StoresPath As String = DataPath & "\Stores"
  8.     Dim CustomersPath As String = DataPath & "\Customers"
  9.     Dim CompanyPath As String = DataPath & "\Company"
  10.     Dim MovmentPath As String = DataPath & "\Movment"
  11.     Dim RequestsPath As String = DataPath & "\Requests"
  12.     Dim BoxPath As String = DataPath & "\Box"
  13.     Dim AlertsPath As String = DataPath & "\Alerts"
  14.     Dim SettingsPath As String = DataPath & "\Settings"
  15.     Dim AddToVindorBoolean As Boolean = False
  16.     Friend WithEvents PrintPreviewControl1 As PrintPreviewControl
  17.     Private WithEvents docToPrint As New Printing.PrintDocument
  18.     Private Shared NewSellInstance As NewSell
  19.     Dim DiscountMNT As Double = 0
  20.     Dim DiscountMNTAfter As Double = 0
  21.     Public Shared Function GetInstance() As NewSell
  22.         If (NewSellInstance Is Nothing) Then
  23.             NewSellInstance = New NewSell
  24.         End If
  25.         Return NewSellInstance
  26.     End Function
  27.     Private Sub NewSell_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  28.         Dim MyWidth As Integer = 0
  29.         MyWidth = Val(LV.Width - TotalPayment.Width - 12) / 4
  30.         LV.Columns.Item(0).Width = MyWidth * 1.5
  31.         LV.Columns.Item(1).Width = MyWidth * 0.8
  32.         LV.Columns.Item(2).Width = MyWidth * 0.7
  33.         LV.Columns.Item(3).Width = MyWidth
  34.         LoadCustomers()
  35.         LoadProducts()
  36.         LoadPaymentWay()
  37.         LoadStores()
  38.         NewSellProNameTXT.Select()
  39.     End Sub
  40.     Private Sub CloseSaveBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseSaveBTN.Click
  41.         StartUp.CloseTabs()
  42.     End Sub
  43.     Public Sub LoadCustomers()
  44.         Dim Addad As Integer = 0
  45.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(CustomersPath).Count - 1
  46.             Dim CustomerName As String = ""
  47.             CustomerName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(CustomersPath).Item(Addad)).Name
  48.             NewSellCusTXT.Items.Add(CustomerName)
  49.         Next
  50.     End Sub
  51.     Public Sub LoadProducts()
  52.         Dim Addad As Integer = 0
  53.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(ProductPath).Count - 1
  54.             Dim ProductName As String = ""
  55.             ProductName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(ProductPath).Item(Addad)).Name
  56.             NewSellProNameTXT.Items.Add(ProductName)
  57.         Next
  58.     End Sub
  59.     Public Sub LoadPaymentWay()
  60.         NewSellPayWayTXT.Items.Clear()
  61.         NewSellPayWayTXT.Items.AddRange(System.IO.File.ReadAllLines(DataPath & "\PaymentWay.dat", System.Text.Encoding.GetEncoding(0)))
  62.     End Sub
  63.     Public Sub LoadStores()
  64.         StoreNameTXT.Text = My.Computer.FileSystem.ReadAllText(DataPath & "\defaultstore.dat", System.Text.Encoding.GetEncoding(0))
  65.         Dim Addad As Integer = 0
  66.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(StoresPath).Count - 1
  67.             Dim StoreName As String = ""
  68.             StoreName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(StoresPath).Item(Addad)).Name
  69.             StoreNameTXT.Items.Add(StoreName)
  70.         Next
  71.     End Sub
  72.     Private Sub NewSellProNameTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellProNameTXT.KeyDown
  73.         If e.KeyCode = Keys.Enter Then NewSellAmountTXT.Select()
  74.     End Sub
  75.     Private Sub NewSellProNameTXT_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewSellProNameTXT.SelectedIndexChanged
  76.         On Error Resume Next
  77.         ProductPicPIC.Image = System.Drawing.Bitmap.FromFile(ProductPath & "\" & NewSellProNameTXT.Text & "\img.pic")
  78.         NewSellBarcodeTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & NewSellProNameTXT.Text & "\barcode.dat", System.Text.Encoding.GetEncoding(0))
  79.     End Sub
  80.     Public Sub AddNewBTNClick()
  81.         'On Error Resume Next
  82.         If My.Computer.FileSystem.DirectoryExists(ProductPath & "\" & NewSellProNameTXT.Text) = False Then GoTo AddNewProduct
  83.         Dim MyItem As ListViewItem = LV.FindItemWithText(NewSellProNameTXT.Text)
  84.         'Write Product Purch Value After DisCount:
  85.         CalcDiscount(Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & NewSellProNameTXT.Text & "\purch.dat", System.Text.Encoding.GetEncoding(0))))
  86.         Dim ProductValue As Double = DiscountMNTAfter
  87.         Dim TotalValue = ProductValue * Val(NewSellAmountTXT.Text)
  88.         If Not MyItem Is Nothing Then
  89.             LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(2).Text += Val(NewSellAmountTXT.Text)
  90.             TotalValue = ProductValue * Val(LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(2).Text)
  91.             LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(3).Text = TotalValue
  92.         Else
  93.             LV.Items.Add(NewSellProNameTXT.Text)
  94.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(ProductValue)
  95.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(NewSellAmountTXT.Text)
  96.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(TotalValue)
  97.         End If
  98.         NewSellProNameTXT.Text = ""
  99.         NewSellBarcodeTXT.Text = ""
  100.         NewSellAmountTXT.Text = ""
  101.         ProductPicPIC.Image = Nothing
  102.         CalcItems()
  103.         Me.Height += 32
  104.         NewSellProNameTXT.Select()
  105.         NewBTN.Enabled = True
  106.         GoTo Finish
  107. AddNewProduct:
  108.         StartUp.OpenNewTab(NewProduct.GetInstance)
  109.         NewProduct.GetInstance.CalledFromWindow("sell", NewSellProNameTXT.Text)
  110. Finish:
  111.     End Sub
  112.     Private Sub AddNewBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddNewBTN.Click
  113.         AddNewBTNClick()
  114.     End Sub
  115.     Public Sub CalcItems()
  116.         Dim Addad As Integer = 0
  117.         Dim TotlaPayment As Double = 0
  118.         For Addad = 0 To LV.Items.Count - 1
  119.             TotlaPayment += Val(LV.Items.Item(Addad).SubItems.Item(3).Text)
  120.         Next
  121.         TotalPayment.Text = "قيمة الفاتورة : " & TotlaPayment & " " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\maincurrency.dat", System.Text.Encoding.GetEncoding(0))
  122.     End Sub
  123.     Private Sub NewSellBarcodeTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellBarcodeTXT.KeyDown
  124.         If e.KeyCode = Keys.Enter Then NewSellAmountTXT.Select()
  125.     End Sub
  126.     Private Sub NewSellBarcodeTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewSellBarcodeTXT.TextChanged
  127.         On Error Resume Next
  128.         Dim PL As New ListBox
  129.         PL.Items.AddRange(System.IO.Directory.GetDirectories(ProductPath))
  130.         Dim Addad As Integer = 0
  131.         For Addad = 0 To PL.Items.Count - 1
  132.             Dim ReeadBarcode As Integer = 0
  133.             ReeadBarcode = Val(My.Computer.FileSystem.ReadAllText(PL.Items.Item(Addad) & "\barcode.dat", System.Text.Encoding.GetEncoding(0)))
  134.             If ReeadBarcode = Val(NewSellBarcodeTXT.Text) Then
  135.                 NewSellProNameTXT.Text = My.Computer.FileSystem.GetDirectoryInfo(PL.Items.Item(Addad)).Name
  136.                 GoTo Finish
  137.             End If
  138.         Next
  139. Finish:
  140.     End Sub
  141.     Private Sub NewSellAmountTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellAmountTXT.KeyDown
  142.         If e.KeyCode = Keys.Enter Then AddNewBTN.Select()
  143.     End Sub
  144.     Private Sub NewBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewBTN.Click
  145.         If PrintCB.Checked = True Then
  146.             PrintIt()
  147.         End If
  148.         SaveChanges()
  149.         ZeroingValues()
  150.     End Sub
  151.     Public Sub PrintIt()
  152.         Dim PForm As New Form
  153.         Me.PPD.Location = New Point(88, 80)
  154.         Me.PPD.Name = "PrintPreviewControl1"
  155.         Me.PPD.Document = docToPrint
  156.         Me.PPD.Document.DocumentName = "c:\someFile"
  157.         Me.PPD.UseAntiAlias = True
  158.         PPD.ShowDialog()
  159.     End Sub
  160.     Private Sub docToPrint_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles docToPrint.PrintPage
  161.         Dim NewForm As New Form
  162.         Dim MyLV As New ListView
  163.         Dim MyLBL As New Label
  164.         Dim Addad As Integer = 0
  165.         Dim SubAddad As Integer = 0
  166.         Dim CName As New Label
  167.         Dim CPic As New PictureBox
  168.         Dim CAdd As New Label
  169.         '...................................................................
  170.         CName.AutoSize = False
  171.         CAdd.AutoSize = False
  172.         CPic.SizeMode = PictureBoxSizeMode.StretchImage
  173.         CName.Left = 45
  174.         CName.Top = 10
  175.         CName.Width = 500
  176.         CName.Height = 27
  177.         CName.Font = New Font("Tahoma", 14, FontStyle.Bold, GraphicsUnit.Pixel, 0)
  178.         CName.ForeColor = Color.Black
  179.         CName.RightToLeft = Windows.Forms.RightToLeft.Yes
  180.         CName.Text = My.Computer.FileSystem.ReadAllText(CompanyPath & "\name.dat", System.Text.Encoding.GetEncoding(0))
  181.         CName.BackColor = Color.White
  182.         CAdd.Left = 45
  183.         CAdd.Top = 40
  184.         CAdd.Width = 500
  185.         CAdd.Height = 27
  186.         CAdd.Font = New Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel, 0)
  187.         CAdd.ForeColor = Color.Black
  188.         CAdd.RightToLeft = Windows.Forms.RightToLeft.Yes
  189.         CAdd.Text = "عنوان : " & My.Computer.FileSystem.ReadAllText(CompanyPath & "\address.dat", System.Text.Encoding.GetEncoding(0)) & "    -    هـ : " & My.Computer.FileSystem.ReadAllText(CompanyPath & "\tel.dat", System.Text.Encoding.GetEncoding(0))
  190.         CAdd.BackColor = Color.White
  191.         CPic.Image = System.Drawing.Bitmap.FromFile(CompanyPath & "\img.pic")
  192.         CPic.Top = 10
  193.         CPic.Left = CName.Left + CName.Width + 5
  194.         CPic.Width = 50
  195.         CPic.Height = 50
  196.         CPic.BorderStyle = Windows.Forms.BorderStyle.FixedSingle
  197.         '...................................................................
  198.         MyLV.GridLines = LV.GridLines
  199.         MyLV.View = LV.View
  200.         MyLV.Font = LV.Font
  201.         MyLV.RightToLeft = LV.RightToLeft
  202.         MyLV.RightToLeftLayout = LV.RightToLeftLayout
  203.         For Addad = 0 To LV.Columns.Count - 1
  204.             MyLV.Columns.Add(LV.Columns.Item(Addad).Text)
  205.         Next
  206.         For Addad = 0 To LV.Items.Count - 1
  207.             MyLV.Items.Add(LV.Items.Item(Addad).Text)
  208.             For SubAddad = 1 To LV.Items.Item(Addad).SubItems.Count - 1
  209.                 MyLV.Items.Item(MyLV.Items.Count - 1).SubItems.Add(LV.Items.Item(Addad).SubItems.Item(SubAddad))
  210.             Next
  211.         Next
  212.         MyLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
  213.         NewForm.Width = LV.Width + 20
  214.         NewForm.Height = LV.Height + 100
  215.         NewForm.BackColor = Color.White
  216.         MyLV.Width = NewForm.Width - 20
  217.         MyLV.Left = 10
  218.         MyLV.Top = 50
  219.         MyLV.Anchor = AnchorStyles.Bottom And AnchorStyles.Right And AnchorStyles.Left And AnchorStyles.Top
  220.         MyLV.Height = LV.Height
  221.         MyLBL.Font = TotalPayment.Font
  222.         MyLBL.Text = TotalPayment.Text & " ، تم الدفع بطريقة : " & NewSellPayWayTXT.Text & "                    " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\footer.dat", System.Text.Encoding.GetEncoding(0))
  223.         MyLBL.TextAlign = ContentAlignment.MiddleRight
  224.         MyLBL.BorderStyle = Windows.Forms.BorderStyle.None
  225.         NewForm.FormBorderStyle = FormBorderStyle.None
  226.         NewForm.Controls.Add(MyLV)
  227.         NewForm.Controls.Add(MyLBL)
  228.         NewForm.Controls.Add(CName)
  229.         NewForm.Controls.Add(CAdd)
  230.         NewForm.Controls.Add(CPic)
  231.         MyLBL.Dock = DockStyle.Bottom
  232.         MyLBL.Select()
  233.         NewForm.Show()
  234.         Dim MyBTMP As New Bitmap(NewForm.Width, NewForm.Height)
  235.         NewForm.DrawToBitmap(MyBTMP, NewForm.ClientRectangle)
  236.         e.Graphics.DrawImage(MyBTMP, New Point(100, 100))
  237.         NewForm.Hide()
  238.     End Sub
  239.     Public Sub CalcDiscount(ByVal Value As Double)
  240.         DiscountMNT = 0
  241.         DiscountMNTAfter = 0
  242.         DiscountMNT = Value * Val(DiscountTXT.Text) / 100
  243.         DiscountMNTAfter = Value - DiscountMNT
  244.     End Sub
  245.     Public Sub SaveChanges()
  246.         On Error Resume Next
  247.         Dim Addad As Integer = 0
  248.         Dim SaveAndAdd As Boolean = False
  249.         For Addad = 0 To LV.Items.Count - 1
  250.             Dim PName As String = ""
  251.             Dim Amount As Double = 0
  252.             Dim LasAmount As Double = 0
  253.             Dim SoldAmount As Double = 0
  254.             Dim PType As String = ""
  255.             PName = LV.Items.Item(Addad).Text
  256.             PType = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\type.dat", System.Text.Encoding.GetEncoding(0))
  257.             Amount = Val(LV.Items.Item(Addad).SubItems.Item(2).Text)
  258.             SoldAmount = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\sold.dat", System.Text.Encoding.GetEncoding(0)))
  259.             If PType = "خدمات" Then GoTo WriteSold
  260.             Dim MyStoreName As String = StoreNameTXT.Text
  261.             Dim FName As String = ""
  262.             If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store.dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount.dat" : GoTo Finish
  263.             If Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\stores.dat", System.Text.Encoding.GetEncoding(0))) = 0 Then
  264.                 If My.Computer.FileSystem.FileExists(ProductPath & "\" & PName & "\mount0.dat") = True Then
  265.                     If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store0.dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount0.dat" : GoTo Finish
  266.                 End If
  267.             Else
  268.                 Dim SubAddad As Integer = 0
  269.                 For SubAddad = 0 To Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\stores.dat", System.Text.Encoding.GetEncoding(0)))
  270.                     If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store" & SubAddad & ".dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount" & SubAddad & ".dat" : GoTo Finish
  271.                 Next
  272.             End If
  273.             ';;;;;;;;;;;;;;;;;;;;;;;;;;
  274.             'Store not contains product
  275.             ';;;;;;;;;;;;;;;;;;;;;;;;;;
  276.             AddToRequests(PName, Amount, MyStoreName)
  277.             GoTo Complete
  278. Finish:
  279.             LasAmount = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\" & FName, System.Text.Encoding.GetEncoding(0)))
  280.             Dim SubResult As Double = 0
  281.             If LasAmount - Amount < 0 And LasAmount > 0 Then
  282.                 If MsgBox("لقد طلب الزبون " & Amount & " من منتج ال" & PName & " ولديك " & LasAmount & " قطعة متوفرة فقط ، هل ترغب ببيع القطع المتوفرة وتسجيل الباقي في طلبات السلع غير المتوفرة؟" & System.Environment.NewLine & "ملاحظة : بحال الضغط على زر لا سيقوم البرنامج بإلغاء بيع ال" & PName & " ونقل الطلب كاملاً إلى الطلبات غير المتوفرة.", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
  283.                     'Sell remaining amount and add to requestes
  284.                     SaveAndAdd = True
  285.                     SubResult = Amount - LasAmount
  286.                     Amount = LasAmount
  287.                     NewSellAmountTXT.Text = Amount
  288.                     LV.Items.Item(Addad).SubItems.Item(2).Text = Amount
  289.                     LV.Items.Item(Addad).SubItems.Item(3).Text = Val(LV.Items.Item(Addad).SubItems.Item(1).Text) * Amount
  290.                     CalcItems()
  291.                     AddToRequests(PName, SubResult, MyStoreName)
  292.                 Else
  293.                     AddToRequests(PName, Amount, MyStoreName) : GoTo Complete
  294.                 End If
  295.             ElseIf LasAmount - Amount < 0 And LasAmount <= 0 Then
  296.                 AddToRequests(PName, Amount, MyStoreName) : GoTo Complete
  297.             End If
  298.             If SaveAndAdd = True Then
  299.                 My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\" & FName, 0, False)
  300.             Else
  301.                 My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\" & FName, LasAmount - Amount, False)
  302.             End If
  303. WriteSold:
  304.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\sold.dat", SoldAmount + Amount, False)
  305.             '...........................................
  306.             'Writting Sell Hestory if Amount is enough :
  307.             '...........................................
  308.             Dim YearSTR As String = Date.Now.Year
  309.             Dim MonthSTR As String = Date.Now.Month
  310.             Dim DaySTR As String = Date.Now.Day
  311.             Dim HourSTR As String = Date.Now.Hour
  312.             Dim MinuteSTR As String = Date.Now.Minute
  313.             Dim SecondSTR As String = Date.Now.Second
  314.             Dim MillisecondSTR As String = Date.Now.Millisecond
  315.             If MonthSTR.Length <= 1 Then MonthSTR = "0" & MonthSTR
  316.             If DaySTR.Length <= 1 Then DaySTR = "0" & DaySTR
  317.             If HourSTR.Length <= 1 Then HourSTR = "0" & HourSTR
  318.             If MinuteSTR.Length <= 1 Then MinuteSTR = "0" & MinuteSTR
  319.             If SecondSTR.Length <= 1 Then SecondSTR = "0" & SecondSTR
  320.             Dim DateDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR & "\" & DaySTR
  321.             Dim MonthDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR
  322.             Dim YearDir As String = MovmentPath & "\" & YearSTR
  323.             Dim WDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR & "\" & DaySTR & "\" & HourSTR & MinuteSTR & SecondSTR & MillisecondSTR
  324.             My.Computer.FileSystem.CreateDirectory(WDir)
  325.             My.Computer.FileSystem.WriteAllText(WDir & "\type.dat", "sell", False)
  326.             My.Computer.FileSystem.WriteAllText(WDir & "\product.dat", PName, False)
  327.             My.Computer.FileSystem.WriteAllText(WDir & "\amount.dat", Amount, False)
  328.             'Write Payment after DisCount:
  329.             My.Computer.FileSystem.WriteAllText(WDir & "\payment.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  330.             Dim InterValue As Double = 0
  331.             Dim TaxValue As Double = 0
  332.             TaxValue = Val(Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\price.dat", System.Text.Encoding.GetEncoding(0))) * Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\maintax.dat", System.Text.Encoding.GetEncoding(0))) / 100) + Val(Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\price.dat", System.Text.Encoding.GetEncoding(0))) * Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\subtax.dat", System.Text.Encoding.GetEncoding(0))) / 100)
  333.             InterValue = Val(LV.Items.Item(Addad).SubItems.Item(3).Text) - Val(Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\price.dat", System.Text.Encoding.GetEncoding(0))) * Amount) - (TaxValue * Amount)
  334.             My.Computer.FileSystem.WriteAllText(WDir & "\inter.dat", InterValue, False)
  335.             My.Computer.FileSystem.WriteAllText(WDir & "\customer.dat", NewSellCusTXT.Text, False)
  336.             My.Computer.FileSystem.WriteAllText(WDir & "\store.dat", StoreNameTXT.Text, False)
  337.             My.Computer.FileSystem.WriteAllText(WDir & "\price.dat", Val(LV.Items.Item(Addad).SubItems.Item(1).Text), False)
  338.             If NoteTXT.Text <> "ملاحظات" Then
  339.                 My.Computer.FileSystem.WriteAllText(WDir & "\note.dat", NoteTXT.Text, False)
  340.             End If
  341.             'Here i will write dept code """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  342.             If NewSellPayWayTXT.Text = "دين" Then GoTo DeptPoint
  343.             Dim LastDayInterValue As Double = 0
  344.             If My.Computer.FileSystem.FileExists(MonthDir & "\inter.dat") = True Then
  345.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(MonthDir & "\inter.dat", System.Text.Encoding.GetEncoding(0)))
  346.             Else
  347.                 LastDayInterValue = 0
  348.             End If
  349.             My.Computer.FileSystem.WriteAllText(MonthDir & "\inter.dat", InterValue + LastDayInterValue, False)
  350.             If My.Computer.FileSystem.FileExists(YearDir & "\inter.dat") = True Then
  351.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(YearDir & "\inter.dat", System.Text.Encoding.GetEncoding(0)))
  352.             Else
  353.                 LastDayInterValue = 0
  354.             End If
  355.             My.Computer.FileSystem.WriteAllText(YearDir & "\inter.dat", InterValue + LastDayInterValue, False)
  356.             '.....................................................
  357.             '.....................................................
  358.             'Write Data To Box :..................................
  359.             '.....................................................
  360.             '.....................................................
  361.             'money
  362.             If My.Computer.FileSystem.FileExists(DateDir & "\money.dat") = True Then
  363.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\money.dat", System.Text.Encoding.GetEncoding(0)))
  364.             Else
  365.                 LastDayInterValue = 0
  366.             End If
  367.             My.Computer.FileSystem.WriteAllText(DateDir & "\money.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text + LastDayInterValue), False)
  368.             My.Computer.FileSystem.WriteAllText(BoxPath & "\money.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text + LastDayInterValue), False)
  369.             'capital
  370.             If My.Computer.FileSystem.FileExists(DateDir & "\capital.dat") = True Then
  371.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\capital.dat", System.Text.Encoding.GetEncoding(0)))
  372.             Else
  373.                 LastDayInterValue = 0
  374.             End If
  375.             Dim TotalPrice As Double = Val(Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\price.dat", System.Text.Encoding.GetEncoding(0))) * Amount)
  376.             My.Computer.FileSystem.WriteAllText(DateDir & "\capital.dat", TotalPrice + LastDayInterValue, False)
  377.             My.Computer.FileSystem.WriteAllText(BoxPath & "\capital.dat", TotalPrice + LastDayInterValue, False)
  378.             'tax
  379.             If My.Computer.FileSystem.FileExists(DateDir & "\tax.dat") = True Then
  380.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\tax.dat", System.Text.Encoding.GetEncoding(0)))
  381.             Else
  382.                 LastDayInterValue = 0
  383.             End If
  384.             Dim TotalTax As Double = TaxValue * Amount
  385.             My.Computer.FileSystem.WriteAllText(DateDir & "\tax.dat", TotalTax + LastDayInterValue, False)
  386.             My.Computer.FileSystem.WriteAllText(BoxPath & "\tax.dat", TotalTax + LastDayInterValue, False)
  387.             'service
  388.             If PType = "خدمات" Then
  389.                 If My.Computer.FileSystem.FileExists(DateDir & "\service.dat") = True Then
  390.                     LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\service.dat", System.Text.Encoding.GetEncoding(0)))
  391.                 Else
  392.                     LastDayInterValue = 0
  393.                 End If
  394.                 My.Computer.FileSystem.WriteAllText(DateDir & "\service.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text) + LastDayInterValue, False)
  395.                 My.Computer.FileSystem.WriteAllText(BoxPath & "\service.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text) + LastDayInterValue, False)
  396.             End If
  397.             'inter
  398.             '...Write inter:
  399.             If My.Computer.FileSystem.FileExists(DateDir & "\inter.dat") = True Then
  400.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\inter.dat", System.Text.Encoding.GetEncoding(0)))
  401.             Else
  402.                 LastDayInterValue = 0
  403.             End If
  404.             My.Computer.FileSystem.WriteAllText(DateDir & "\inter.dat", InterValue + LastDayInterValue, False)
  405.             My.Computer.FileSystem.WriteAllText(BoxPath & "\inter.dat", InterValue + LastDayInterValue, False)
  406. DeptPoint:
  407.             '.....................................................
  408.             '.....................................................
  409.             'read and correct requests :..........................
  410.             '.....................................................
  411.             '.....................................................
  412.             If PType = "خدمات" Then GoTo SkipRequests
  413. TestPoint:
  414.             If My.Computer.FileSystem.DirectoryExists(RequestsPath & "\" & PName) = True Then
  415.                 Dim MyTXT As String = My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & PName & "\customers.dat", System.Text.Encoding.GetEncoding(0))
  416.                 If MyTXT.Contains(NewSellCusTXT.Text) = True Then
  417.                     MyTXT = MyTXT.Replace("," & NewSellCusTXT.Text, "")
  418.                     Dim MyLastAmount As Double = 0
  419.                     MyLastAmount = Val(My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & PName & "\amount.dat", System.Text.Encoding.GetEncoding(0)))
  420.                     If MyLastAmount <= 1 Or MyLastAmount - Amount <= 0 Then
  421.                         If SaveAndAdd = False Then
  422.                             System.IO.Directory.Delete(RequestsPath & "\" & PName, True)
  423.                         End If
  424.                     Else
  425.                         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\amount.dat", MyLastAmount - Amount, False)
  426.                         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\customers.dat", MyTXT, False)
  427.                     End If
  428.                 End If
  429.             Else
  430.                 My.Computer.FileSystem.CreateDirectory(RequestsPath & "\" & PName)
  431.                 My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\customers.dat", "", False, System.Text.Encoding.GetEncoding(0))
  432.                 My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\amount.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  433.                 My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\stores.dat", "," & StoreNameTXT.Text, False, System.Text.Encoding.GetEncoding(0))
  434.                 GoTo TestPoint
  435.             End If
  436. SkipRequests:
  437.             If AddToVindorBoolean = False Then AddToCustomer(YearSTR & MonthSTR & DaySTR & HourSTR & MinuteSTR)
  438. Complete:
  439.         Next
  440.         'My.Computer.FileSystem.WriteAllText("", NoteTXT.Text, False, System.Text.Encoding.GetEncoding(0))
  441.         AddToVindorBoolean = False
  442.     End Sub
  443.     Public Sub ZeroingValues()
  444.         NewSellProNameTXT.Text = ""
  445.         NewSellAmountTXT.Text = ""
  446.         NewBTN.Enabled = False
  447.         LV.Items.Clear()
  448.         TotalPayment.Text = "قيمة الفاتورة : 0" & " " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\maincurrency.dat", System.Text.Encoding.GetEncoding(0))
  449.         Me.Height = 467
  450.     End Sub
  451.     Public Sub AddToCustomer(ByVal SDate As String)
  452.         Dim Addad As Integer = 0
  453.         For Addad = 0 To LV.Items.Count - 1
  454.             Dim CPath As String = CustomersPath & "\" & NewSellCusTXT.Text
  455.             Dim DateSTR As String = SDate & Date.Now.Millisecond
  456.             Dim PName As String = LV.Items.Item(Addad).Text
  457.             Dim PAmount As Double = Val(LV.Items.Item(Addad).SubItems(2).Text)
  458.             Dim PaymentTotal As Double = Val(LV.Items.Item(Addad).SubItems(3).Text)
  459.             Dim PayDBL As Double = 0
  460.             Dim RemainDBL As Double = 0
  461.             If NewSellPayWayTXT.Text = "دين" Then
  462.                 PayDBL = 0
  463.                 RemainDBL = PaymentTotal
  464.             Else
  465.                 PayDBL = PaymentTotal
  466.                 RemainDBL = 0
  467.             End If
  468.             If My.Computer.FileSystem.DirectoryExists(CPath) = True Then
  469.                 If My.Computer.FileSystem.DirectoryExists(CPath & "\payment") = False Then My.Computer.FileSystem.CreateDirectory(CPath & "\payment")
  470.  
  471.             Else
  472.                 'Add New Customer Then Write info : (when creating new customer from here notify user to complete the cinfo)
  473.                 My.Computer.FileSystem.CreateDirectory(CPath)
  474.                 If My.Computer.FileSystem.DirectoryExists(CPath & "\payment") = False Then My.Computer.FileSystem.CreateDirectory(CPath & "\payment")
  475.                 My.Computer.FileSystem.WriteAllText(CPath & "\name.dat", NewSellCusTXT.Text, False, System.Text.Encoding.GetEncoding(0))
  476.                 My.Computer.FileSystem.WriteAllText(CPath & "\address.dat", "", False, System.Text.Encoding.GetEncoding(0))
  477.                 My.Computer.FileSystem.WriteAllText(CPath & "\tel.dat", "", False, System.Text.Encoding.GetEncoding(0))
  478.                 My.Computer.FileSystem.WriteAllText(CPath & "\mail.dat", "", False, System.Text.Encoding.GetEncoding(0))
  479.                 My.Computer.FileSystem.WriteAllText(CPath & "\web.dat", "", False, System.Text.Encoding.GetEncoding(0))
  480.                 My.Computer.FileSystem.WriteAllText(CPath & "\job.dat", "", False, System.Text.Encoding.GetEncoding(0))
  481.                 My.Computer.FileSystem.WriteAllText(CPath & "\jobaddress.dat", "", False, System.Text.Encoding.GetEncoding(0))
  482.                 My.Computer.FileSystem.WriteAllText(CPath & "\totaldept.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  483.                 My.Computer.FileSystem.WriteAllText(CPath & "\totalpayment.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  484.                 'TotalDept
  485.             End If
  486.             My.Computer.FileSystem.CreateDirectory(CPath & "\payment\" & DateSTR)
  487.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\date.dat", DateSTR, False, System.Text.Encoding.GetEncoding(0))
  488.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\pname.dat", PName, False, System.Text.Encoding.GetEncoding(0))
  489.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\pamount.dat", PAmount, False, System.Text.Encoding.GetEncoding(0))
  490.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\paymenttotal.dat", PaymentTotal, False, System.Text.Encoding.GetEncoding(0))
  491.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\paydbl.dat", PayDBL, False, System.Text.Encoding.GetEncoding(0))
  492.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\remaindbl.dat", RemainDBL, False, System.Text.Encoding.GetEncoding(0))
  493.             PayDBL += Val(My.Computer.FileSystem.ReadAllText(CPath & "\totalpayment.dat", System.Text.Encoding.GetEncoding(0)))
  494.             RemainDBL += Val(My.Computer.FileSystem.ReadAllText(CPath & "\totaldept.dat", System.Text.Encoding.GetEncoding(0)))
  495.             My.Computer.FileSystem.WriteAllText(CPath & "\totaldept.dat", RemainDBL, False, System.Text.Encoding.GetEncoding(0))
  496.             Dim LTP As Double = Val(My.Computer.FileSystem.ReadAllText(CPath & "\totalpayment.dat", System.Text.Encoding.GetEncoding(0)))
  497.             My.Computer.FileSystem.WriteAllText(CPath & "\totalpayment.dat", PaymentTotal + LTP, False, System.Text.Encoding.GetEncoding(0))
  498.         Next
  499.         AddToVindorBoolean = True
  500.     End Sub
  501.     Public Sub AddToRequests(ByVal Pname As String, ByVal Amount As Double, ByVal SName As String)
  502.         If My.Computer.FileSystem.DirectoryExists(RequestsPath & "\" & Pname) = False Then
  503.             My.Computer.FileSystem.CreateDirectory(RequestsPath & "\" & Pname)
  504.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\amount.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  505.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\customers.dat", "", False, System.Text.Encoding.GetEncoding(0))
  506.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\stores.dat", "", False, System.Text.Encoding.GetEncoding(0))
  507.         End If
  508.         Dim LastAmount As Double = Val(My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\amount.dat", System.Text.Encoding.GetEncoding(0)))
  509.         Dim LastC As String = My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\customers.dat", System.Text.Encoding.GetEncoding(0))
  510.         Dim LastS As String = My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\stores.dat", System.Text.Encoding.GetEncoding(0))
  511.         LastAmount += Amount
  512.         If LastC.Contains(NewSellCusTXT.Text) = False Then LastC = LastC & "," & NewSellCusTXT.Text
  513.         If LastS.Contains(SName) = False Then LastS = LastS & "," & SName
  514.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\amount.dat", LastAmount, False, System.Text.Encoding.GetEncoding(0))
  515.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\customers.dat", LastC, False, System.Text.Encoding.GetEncoding(0))
  516.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\stores.dat", LastS, False, System.Text.Encoding.GetEncoding(0))
  517.         'test values to add errors to Alerts :
  518.         StartUp.AlertsWriter(Pname, "كمية الـ " & Pname & " المتبقية غير كافية , أنقر هنا لفتح طلب شراء للمنتج", "P-need")
  519.         StartUp.LoadAlerts()
  520.         'write to customer path requesting info :
  521.         'by loading req dirs and compare files .
  522.         MsgBox("كمية ال" & Pname & " المطلوب بيعها غير كافية في مخزن " & SName & " حالياً ، لقد تمت إضافة الطلب إلى قائمة طلبات السلع غير المتوفرة.")
  523.     End Sub
  524.     Private Sub DelBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DelBTN.Click
  525.         If LV.SelectedItems.Count > 0 Then
  526.             LV.Items.Remove(LV.FocusedItem)
  527.             If LV.Items.Count < 1 Then
  528.                 ZeroingValues()
  529.             End If
  530.         End If
  531.     End Sub
  532.     Private Sub NewSellCusTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellCusTXT.KeyDown
  533.         If e.KeyCode = Keys.Enter Then NewSellProNameTXT.Select()
  534.     End Sub
  535.     Private Sub NewSellPayWayTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellPayWayTXT.KeyDown
  536.         If e.KeyCode = Keys.Enter Then AddNewBTN.Select()
  537.     End Sub
  538.     Private Sub StoreNameTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StoreNameTXT.KeyDown
  539.         If e.KeyCode = Keys.Enter Then AddNewBTN.Select()
  540.     End Sub
  541.     Private Sub DiscountTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiscountTXT.TextChanged
  542.  
  543.     End Sub
  544. End Class

Valuable E-Book

Hello,
Baby first step is a friendly flashcards offering a growing collection of creative and educational ideas to help the toddler to learn the alphabet, so I put images that would be attractive to babies.

Support independent publishing: Buy this e-book on Lulu.