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 - NewBuy.vb

NewBuy.vb
  1. Public Class NewBuy
  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 VendorsPath As String = DataPath & "\Vendors"
  13.     Dim BoxPath As String = DataPath & "\Box"
  14.     Dim AlertsPath As String = DataPath & "\Alerts"
  15.     Dim SettingsPath As String = DataPath & "\Settings"
  16.     Dim AddToVindorBoolean As Boolean = False
  17.     Friend WithEvents PrintPreviewControl1 As PrintPreviewControl
  18.     Private WithEvents docToPrint As New Printing.PrintDocument
  19.     Private Shared NewBuyInstance As NewBuy
  20.     Public Shared Function GetInstance() As NewBuy
  21.         If (NewBuyInstance Is Nothing) Then
  22.             NewBuyInstance = New NewBuy
  23.         End If
  24.         Return NewBuyInstance
  25.     End Function
  26.     Private Sub NewSell_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  27.         Dim MyWidth As Integer = 0
  28.         MyWidth = Val(LV.Width - TotalPayment.Width - 12) / 4
  29.         LV.Columns.Item(0).Width = MyWidth * 1.5
  30.         LV.Columns.Item(1).Width = MyWidth * 0.8
  31.         LV.Columns.Item(2).Width = MyWidth * 0.7
  32.         LV.Columns.Item(3).Width = MyWidth
  33.         'LV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
  34.         LoadVendors()
  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.         'Save Operator will be here
  42.         StartUp.CloseTabs()
  43.     End Sub
  44.     Public Sub LoadVendors()
  45.         Dim Addad As Integer = 0
  46.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(VendorsPath).Count - 1
  47.             Dim VName As String = ""
  48.             VName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(VendorsPath).Item(Addad)).Name
  49.             NewSellCusTXT.Items.Add(VName)
  50.         Next
  51.     End Sub
  52.     Public Sub LoadProducts()
  53.         Dim Addad As Integer = 0
  54.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(ProductPath).Count - 1
  55.             Dim ProductName As String = ""
  56.             If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.GetDirectories(ProductPath).Item(Addad) & "\price.dat") = True Then
  57.                 ProductName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(ProductPath).Item(Addad)).Name
  58.                 NewSellProNameTXT.Items.Add(ProductName)
  59.             End If
  60.         Next
  61.     End Sub
  62.     Public Sub LoadPaymentWay()
  63.         NewSellPayWayTXT.Items.Clear()
  64.         NewSellPayWayTXT.Items.AddRange(System.IO.File.ReadAllLines(DataPath & "\PaymentWay.dat", System.Text.Encoding.GetEncoding(0)))
  65.     End Sub
  66.     Public Sub LoadStores()
  67.         StoreNameTXT.Text = My.Computer.FileSystem.ReadAllText(DataPath & "\defaultstore.dat", System.Text.Encoding.GetEncoding(0))
  68.         Dim Addad As Integer = 0
  69.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(StoresPath).Count - 1
  70.             Dim StoreName As String = ""
  71.             StoreName = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(StoresPath).Item(Addad)).Name
  72.             StoreNameTXT.Items.Add(StoreName)
  73.         Next
  74.     End Sub
  75.     Private Sub NewSellProNameTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellProNameTXT.KeyDown
  76.         If e.KeyCode = Keys.Enter Then NewSellAmountTXT.Select()
  77.     End Sub
  78.     Private Sub NewSellProNameTXT_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewSellProNameTXT.SelectedIndexChanged
  79.         ProductPicPIC.Image = System.Drawing.Bitmap.FromFile(ProductPath & "\" & NewSellProNameTXT.Text & "\img.pic")
  80.         NewSellBarcodeTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & NewSellProNameTXT.Text & "\barcode.dat", System.Text.Encoding.GetEncoding(0))
  81.     End Sub
  82.     Public Sub AddNewBTNClick()
  83.         If My.Computer.FileSystem.DirectoryExists(ProductPath & "\" & NewSellProNameTXT.Text) = False Or My.Computer.FileSystem.FileExists(ProductPath & "\" & NewSellProNameTXT.Text & "\price.dat") = False Then GoTo AddNewProduct
  84.         Dim MyItem As ListViewItem = LV.FindItemWithText(NewSellProNameTXT.Text)
  85.         Dim ProductValue As Double = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & NewSellProNameTXT.Text & "\price.dat", System.Text.Encoding.GetEncoding(0)))
  86.         Dim TotalValue = ProductValue * Val(NewSellAmountTXT.Text)
  87.         If Not MyItem Is Nothing Then
  88.             LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(2).Text += Val(NewSellAmountTXT.Text)
  89.             TotalValue = ProductValue * Val(LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(2).Text)
  90.             LV.FindItemWithText(NewSellProNameTXT.Text).SubItems.Item(3).Text = TotalValue
  91.         Else
  92.             LV.Items.Add(NewSellProNameTXT.Text)
  93.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(ProductValue)
  94.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(NewSellAmountTXT.Text)
  95.             LV.Items.Item(LV.Items.Count - 1).SubItems.Add(TotalValue)
  96.         End If
  97.         NewSellProNameTXT.Text = ""
  98.         NewSellBarcodeTXT.Text = ""
  99.         NewSellAmountTXT.Text = ""
  100.         ProductPicPIC.Image = Nothing
  101.         CalcItems()
  102.         Me.Height += 32
  103.         NewSellProNameTXT.Select()
  104.         NewBTN.Enabled = True
  105.         GoTo Finish
  106. AddNewProduct:
  107.         StartUp.OpenNewTab(NewProduct.GetInstance)
  108.         NewProduct.GetInstance.CalledFromWindow("buy", NewSellProNameTXT.Text)
  109. Finish:
  110.     End Sub
  111.     Private Sub AddNewBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddNewBTN.Click
  112.         AddNewBTNClick()
  113.     End Sub
  114.     Public Sub CalcItems()
  115.         Dim Addad As Integer = 0
  116.         Dim TotlaPayment As Double = 0
  117.         For Addad = 0 To LV.Items.Count - 1
  118.             TotlaPayment += Val(LV.Items.Item(Addad).SubItems.Item(3).Text)
  119.         Next
  120.         TotalPayment.Text = "قيمة الفاتورة : " & TotlaPayment & " " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\maincurrency.dat", System.Text.Encoding.GetEncoding(0))
  121.         TotalPayment.Tag = TotlaPayment
  122.         NewSellPayAmountTXT.Text = TotlaPayment
  123.     End Sub
  124.     Private Sub NewSellBarcodeTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellBarcodeTXT.KeyDown
  125.         If e.KeyCode = Keys.Enter Then NewSellAmountTXT.Select()
  126.     End Sub
  127.     Private Sub NewSellBarcodeTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewSellBarcodeTXT.TextChanged
  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.     End Sub
  150.     Public Sub PrintIt()
  151.         PPD.Location = New Point(88, 80)
  152.         PPD.Name = "PrintPreviewControl1"
  153.         PPD.Document = docToPrint
  154.         PPD.Document.DocumentName = "c:\someFile"
  155.         PPD.UseAntiAlias = True
  156.         PPD.ShowDialog()
  157.     End Sub
  158.     Private Sub docToPrint_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles docToPrint.PrintPage
  159.         Dim NewForm As New Form
  160.         Dim MyLV As New ListView
  161.         Dim MyLBL As New Label
  162.         Dim Addad As Integer = 0
  163.         Dim SubAddad As Integer = 0
  164.         Dim CName As New Label
  165.         Dim CPic As New PictureBox
  166.         Dim CAdd As New Label
  167.         '...................................................................
  168.         CName.AutoSize = False
  169.         CAdd.AutoSize = False
  170.         CPic.SizeMode = PictureBoxSizeMode.StretchImage
  171.         CName.Left = 45
  172.         CName.Top = 10
  173.         CName.Width = 500
  174.         CName.Height = 27
  175.         CName.Font = New Font("Tahoma", 14, FontStyle.Bold, GraphicsUnit.Pixel, 0)
  176.         CName.ForeColor = Color.Black
  177.         CName.RightToLeft = Windows.Forms.RightToLeft.Yes
  178.         CName.Text = My.Computer.FileSystem.ReadAllText(CompanyPath & "\name.dat", System.Text.Encoding.GetEncoding(0))
  179.         CName.BackColor = Color.White
  180.         CAdd.Left = 45
  181.         CAdd.Top = 40
  182.         CAdd.Width = 500
  183.         CAdd.Height = 27
  184.         CAdd.Font = New Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel, 0)
  185.         CAdd.ForeColor = Color.Black
  186.         CAdd.RightToLeft = Windows.Forms.RightToLeft.Yes
  187.         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))
  188.         CAdd.BackColor = Color.White
  189.         CPic.Image = System.Drawing.Bitmap.FromFile(CompanyPath & "\img.pic")
  190.         CPic.Top = 10
  191.         CPic.Left = CName.Left + CName.Width + 5
  192.         CPic.Width = 50
  193.         CPic.Height = 50
  194.         CPic.BorderStyle = Windows.Forms.BorderStyle.FixedSingle
  195.         '...................................................................
  196.         MyLV.GridLines = LV.GridLines
  197.         MyLV.View = LV.View
  198.         MyLV.Font = LV.Font
  199.         MyLV.RightToLeft = LV.RightToLeft
  200.         MyLV.RightToLeftLayout = LV.RightToLeftLayout
  201.         For Addad = 0 To LV.Columns.Count - 1
  202.             MyLV.Columns.Add(LV.Columns.Item(Addad).Text)
  203.         Next
  204.         For Addad = 0 To LV.Items.Count - 1
  205.             MyLV.Items.Add(LV.Items.Item(Addad).Text)
  206.             For SubAddad = 1 To LV.Items.Item(Addad).SubItems.Count - 1
  207.                 MyLV.Items.Item(MyLV.Items.Count - 1).SubItems.Add(LV.Items.Item(Addad).SubItems.Item(SubAddad))
  208.             Next
  209.         Next
  210.         MyLV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
  211.         NewForm.Width = LV.Width + 20
  212.         NewForm.Height = LV.Height + 100
  213.         NewForm.BackColor = Color.White
  214.         MyLV.Width = NewForm.Width - 20
  215.         MyLV.Left = 10
  216.         MyLV.Top = 50
  217.         MyLV.Anchor = AnchorStyles.Bottom And AnchorStyles.Right And AnchorStyles.Left And AnchorStyles.Top
  218.         MyLV.Height = LV.Height
  219.         MyLBL.Font = TotalPayment.Font
  220.         MyLBL.Text = TotalPayment.Text & " ، تم الدفع للتاجر " & NewSellCusTXT.Text & " بطريقة : " & NewSellPayWayTXT.Text & "                    " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\footer.dat", System.Text.Encoding.GetEncoding(0))
  221.         MyLBL.TextAlign = ContentAlignment.MiddleRight
  222.         MyLBL.BorderStyle = Windows.Forms.BorderStyle.None
  223.         NewForm.FormBorderStyle = FormBorderStyle.None
  224.         NewForm.Controls.Add(MyLV)
  225.         NewForm.Controls.Add(MyLBL)
  226.         NewForm.Controls.Add(CName)
  227.         NewForm.Controls.Add(CAdd)
  228.         NewForm.Controls.Add(CPic)
  229.         MyLBL.Dock = DockStyle.Bottom
  230.         MyLBL.Select()
  231.         NewForm.Show()
  232.         Dim MyBTMP As New Bitmap(NewForm.Width, NewForm.Height)
  233.         NewForm.DrawToBitmap(MyBTMP, NewForm.ClientRectangle)
  234.         e.Graphics.DrawImage(MyBTMP, New Point(100, 100))
  235.         NewForm.Hide()
  236.     End Sub
  237.     Public Sub SaveChanges()
  238.         Dim Addad As Integer = 0
  239.         Dim SaveAndAdd As Boolean = False
  240.         Dim MyTotlaPayment As Double = 0
  241.         For Addad = 0 To LV.Items.Count - 1
  242.             MyTotlaPayment += Val(LV.Items.Item(Addad).SubItems.Item(3).Text)
  243.         Next
  244.         If Val(My.Computer.FileSystem.ReadAllText(BoxPath & "\capital.dat", System.Text.Encoding.GetEncoding(0))) < MyTotlaPayment And NewSellPayWayTXT.Text <> "دين" Then GoTo EndPoint
  245.         For Addad = 0 To LV.Items.Count - 1
  246.             Dim PName As String = ""
  247.             Dim Amount As Double = 0
  248.             Dim LasAmount As Double = 0
  249.             Dim SoldAmount As Double = 0
  250.             Dim TAddad As Integer = 0
  251.             PName = LV.Items.Item(Addad).Text
  252.             Amount = Val(LV.Items.Item(Addad).SubItems.Item(2).Text)
  253.             SoldAmount = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\sold.dat", System.Text.Encoding.GetEncoding(0)))
  254.             Dim MyStoreName As String = StoreNameTXT.Text
  255.             Dim FName As String = ""
  256.             If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store.dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount.dat" : GoTo Finish
  257.             If Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\stores.dat", System.Text.Encoding.GetEncoding(0))) = 0 Then
  258.                 If My.Computer.FileSystem.FileExists(ProductPath & "\" & PName & "\mount0.dat") = True Then
  259.                     If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store0.dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount0.dat" : GoTo Finish
  260.                 End If
  261.             Else
  262.                 Dim SubAddad As Integer = 0
  263.                 For SubAddad = 0 To Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\stores.dat", System.Text.Encoding.GetEncoding(0)))
  264.                     If MyStoreName = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\store" & SubAddad & ".dat", System.Text.Encoding.GetEncoding(0)) Then FName = "mount" & SubAddad & ".dat" : GoTo Finish
  265.                 Next
  266.             End If
  267.             ';;;;;;;;;;;;;;;;;;;;;;;;;;
  268.             'Store not contains product
  269.             'add product to store :
  270.             ';;;;;;;;;;;;;;;;;;;;;;;;;;
  271.             TAddad = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\stores.dat", System.Text.Encoding.GetEncoding(0))) + 1
  272.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\store" & TAddad & ".dat", MyStoreName, False, System.Text.Encoding.GetEncoding(0))
  273.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\mount" & TAddad & ".dat", 0, False, System.Text.Encoding.GetEncoding(0))
  274.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\unit" & TAddad & ".dat", "", False, System.Text.Encoding.GetEncoding(0))
  275.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\stores.dat", TAddad, False, System.Text.Encoding.GetEncoding(0))
  276.             FName = "mount" & TAddad & ".dat"
  277. Finish:
  278.             LasAmount = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & PName & "\" & FName, System.Text.Encoding.GetEncoding(0)))
  279.             My.Computer.FileSystem.WriteAllText(ProductPath & "\" & PName & "\" & FName, LasAmount + Amount, False)
  280.             '...........................................
  281.             'Writting Buy Hestory
  282.             '...........................................
  283.             Dim YearSTR As String = Date.Now.Year
  284.             Dim MonthSTR As String = Date.Now.Month
  285.             Dim DaySTR As String = Date.Now.Day
  286.             Dim HourSTR As String = Date.Now.Hour
  287.             Dim MinuteSTR As String = Date.Now.Minute
  288.             Dim SecondSTR As String = Date.Now.Second
  289.             Dim MillisecondSTR As String = Date.Now.Millisecond
  290.             If MonthSTR.Length <= 1 Then MonthSTR = "0" & MonthSTR
  291.             If DaySTR.Length <= 1 Then DaySTR = "0" & DaySTR
  292.             If HourSTR.Length <= 1 Then HourSTR = "0" & HourSTR
  293.             If MinuteSTR.Length <= 1 Then MinuteSTR = "0" & MinuteSTR
  294.             If SecondSTR.Length <= 1 Then SecondSTR = "0" & SecondSTR
  295.             Dim DateDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR & "\" & DaySTR
  296.             Dim MonthDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR
  297.             Dim YearDir As String = MovmentPath & "\" & YearSTR
  298.             Dim WDir As String = MovmentPath & "\" & YearSTR & "\" & MonthSTR & "\" & DaySTR & "\" & HourSTR & MinuteSTR & SecondSTR & MillisecondSTR
  299.             My.Computer.FileSystem.CreateDirectory(WDir)
  300.             My.Computer.FileSystem.WriteAllText(WDir & "\type.dat", "buy", False)
  301.             My.Computer.FileSystem.WriteAllText(WDir & "\product.dat", PName, False)
  302.             My.Computer.FileSystem.WriteAllText(WDir & "\amount.dat", Amount, False)
  303.             My.Computer.FileSystem.WriteAllText(WDir & "\payment.dat", Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  304.             Dim InterValue As Double = 0
  305.             Dim TaxValue As Double = 0
  306.             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)
  307.             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)
  308.             My.Computer.FileSystem.WriteAllText(WDir & "\inter.dat", InterValue, False)
  309.             My.Computer.FileSystem.WriteAllText(WDir & "\customer.dat", NewSellCusTXT.Text, False)
  310.             My.Computer.FileSystem.WriteAllText(WDir & "\store.dat", StoreNameTXT.Text, False)
  311.             My.Computer.FileSystem.WriteAllText(WDir & "\price.dat", Val(LV.Items.Item(Addad).SubItems.Item(1).Text), False)
  312.             Dim ProductReq As Integer = 0
  313.             If My.Computer.FileSystem.DirectoryExists(RequestsPath & "\" & PName) = True Then
  314.                 ProductReq = Val(My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & PName & "\amount.dat", System.Text.Encoding.GetEncoding(0)))
  315.                 If ProductReq <= LasAmount + Amount Then
  316.                     System.IO.Directory.Delete(RequestsPath & "\" & PName, True)
  317.                 Else
  318.                     My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & PName & "\amount.dat", ProductReq - LasAmount + Amount, False)
  319.                 End If
  320.             End If
  321.             Dim TWDir As String = ""
  322.             TWDir = AlertsPath & "\" & PName & "\P-need"
  323.             If My.Computer.FileSystem.DirectoryExists(TWDir) Then System.IO.Directory.Delete(TWDir, True)
  324.             StartUp.LoadAlerts()
  325.             '.....................................................
  326.             '.....................................................
  327.             'Write Data To Box :..................................
  328.             '.....................................................
  329.             '.....................................................
  330.             'Here i will write dept code """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  331.             If NewSellPayWayTXT.Text = "دين" Then GoTo DeptPoint
  332.             Dim LastDayInterValue As Double = 0
  333.             'money
  334.             If My.Computer.FileSystem.FileExists(DateDir & "\money.dat") = True Then
  335.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\money.dat", System.Text.Encoding.GetEncoding(0)))
  336.             Else
  337.                 LastDayInterValue = 0
  338.             End If
  339.             My.Computer.FileSystem.WriteAllText(DateDir & "\money.dat", LastDayInterValue - Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  340.             My.Computer.FileSystem.WriteAllText(BoxPath & "\money.dat", LastDayInterValue - Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  341.             'capital
  342.             If My.Computer.FileSystem.FileExists(DateDir & "\capital.dat") = True Then
  343.                 LastDayInterValue = Val(My.Computer.FileSystem.ReadAllText(DateDir & "\capital.dat", System.Text.Encoding.GetEncoding(0)))
  344.             Else
  345.                 LastDayInterValue = 0
  346.             End If
  347.             My.Computer.FileSystem.WriteAllText(DateDir & "\capital.dat", LastDayInterValue - Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  348.             My.Computer.FileSystem.WriteAllText(BoxPath & "\capital.dat", LastDayInterValue - Val(LV.Items.Item(Addad).SubItems.Item(3).Text), False)
  349. DeptPoint:
  350.             If AddToVindorBoolean = False Then AddToVindor(YearSTR & MonthSTR & DaySTR & HourSTR & MinuteSTR)
  351. Complete:
  352.         Next
  353.         AddToVindorBoolean = False
  354.         ZeroingValues()
  355.         GoTo Endding
  356. EndPoint:
  357.         MsgBox("إن قيمة الفاتورة أكبر من قيمة رأس المال في صندوقك ، يمكنك تحويل المال إلى خانة رأس المال بالدخول إلى الصندوق")
  358. Endding:
  359.     End Sub
  360.     Public Sub ZeroingValues()
  361.         NewSellProNameTXT.Text = ""
  362.         NewSellAmountTXT.Text = ""
  363.         NewBTN.Enabled = False
  364.         LV.Items.Clear()
  365.         TotalPayment.Text = "قيمة الفاتورة : 0" & " " & My.Computer.FileSystem.ReadAllText(SettingsPath & "\maincurrency.dat", System.Text.Encoding.GetEncoding(0))
  366.         'LV.Height = 66
  367.         Me.Height = 467
  368.     End Sub
  369.     Public Sub AddToVindor(ByVal SDate As String)
  370.         Dim Addad As Integer = 0
  371.         For Addad = 0 To LV.Items.Count - 1
  372.             If LV.Items.Item(Addad).Text = "" Or LV.Items.Item(Addad).SubItems.Count < 1 Then GoTo EndOfAdd
  373.             Dim CPath As String = VendorsPath & "\" & NewSellCusTXT.Text
  374.             Dim DateSTR As String = SDate & Date.Now.Millisecond
  375.             Dim PName As String = LV.Items.Item(Addad).Text
  376.             Dim PAmount As Double = Val(LV.Items.Item(Addad).SubItems(2).Text)
  377.             Dim PaymentTotal As Double = Val(LV.Items.Item(Addad).SubItems(3).Text)
  378.             Dim PayDBL As Double = 0
  379.             Dim RemainDBL As Double = 0
  380.             If NewSellPayWayTXT.Text = "دين" Then
  381.                 PayDBL = 0
  382.                 RemainDBL = PaymentTotal
  383.             Else
  384.                 PayDBL = PaymentTotal
  385.                 RemainDBL = 0
  386.             End If
  387.             If My.Computer.FileSystem.DirectoryExists(CPath) = True Then
  388.                 If My.Computer.FileSystem.DirectoryExists(CPath & "\payment") = False Then My.Computer.FileSystem.CreateDirectory(CPath & "\payment")
  389.             Else
  390.                 'Add New Vendor Then Write info : (when creating new Vendor from here notify user to complete the cinfo)
  391.                 My.Computer.FileSystem.CreateDirectory(CPath)
  392.                 If My.Computer.FileSystem.DirectoryExists(CPath & "\payment") = False Then My.Computer.FileSystem.CreateDirectory(CPath & "\payment")
  393.                 My.Computer.FileSystem.WriteAllText(CPath & "\name.dat", NewSellCusTXT.Text, False, System.Text.Encoding.GetEncoding(0))
  394.                 My.Computer.FileSystem.WriteAllText(CPath & "\address.dat", "", False, System.Text.Encoding.GetEncoding(0))
  395.                 My.Computer.FileSystem.WriteAllText(CPath & "\tel.dat", "", False, System.Text.Encoding.GetEncoding(0))
  396.                 My.Computer.FileSystem.WriteAllText(CPath & "\mail.dat", "", False, System.Text.Encoding.GetEncoding(0))
  397.                 My.Computer.FileSystem.WriteAllText(CPath & "\web.dat", "", False, System.Text.Encoding.GetEncoding(0))
  398.                 My.Computer.FileSystem.WriteAllText(CPath & "\job.dat", "", False, System.Text.Encoding.GetEncoding(0))
  399.                 My.Computer.FileSystem.WriteAllText(CPath & "\jobaddress.dat", "", False, System.Text.Encoding.GetEncoding(0))
  400.                 My.Computer.FileSystem.WriteAllText(CPath & "\totaldept.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  401.                 My.Computer.FileSystem.WriteAllText(CPath & "\totalpayment.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  402.             End If
  403.             My.Computer.FileSystem.CreateDirectory(CPath & "\payment\" & DateSTR)
  404.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\date.dat", DateSTR, False, System.Text.Encoding.GetEncoding(0))
  405.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\pname.dat", PName, False, System.Text.Encoding.GetEncoding(0))
  406.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\pamount.dat", PAmount, False, System.Text.Encoding.GetEncoding(0))
  407.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\paymenttotal.dat", PaymentTotal, False, System.Text.Encoding.GetEncoding(0))
  408.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\paydbl.dat", PayDBL, False, System.Text.Encoding.GetEncoding(0))
  409.             My.Computer.FileSystem.WriteAllText(CPath & "\payment\" & DateSTR & "\remaindbl.dat", RemainDBL, False, System.Text.Encoding.GetEncoding(0))
  410.             PayDBL += Val(My.Computer.FileSystem.ReadAllText(CPath & "\totalpayment.dat", System.Text.Encoding.GetEncoding(0)))
  411.             RemainDBL += Val(My.Computer.FileSystem.ReadAllText(CPath & "\totaldept.dat", System.Text.Encoding.GetEncoding(0)))
  412.             My.Computer.FileSystem.WriteAllText(CPath & "\totaldept.dat", RemainDBL, False, System.Text.Encoding.GetEncoding(0))
  413.             Dim LTP As Double = Val(My.Computer.FileSystem.ReadAllText(CPath & "\totalpayment.dat", System.Text.Encoding.GetEncoding(0)))
  414.             My.Computer.FileSystem.WriteAllText(CPath & "\totalpayment.dat", PaymentTotal + LTP, False, System.Text.Encoding.GetEncoding(0))
  415.             'My.Computer.FileSystem.WriteAllText(CPath & "\totalpayment.dat", PaymentTotal, False, System.Text.Encoding.GetEncoding(0))
  416. EndOfAdd:
  417.         Next
  418.         AddToVindorBoolean = True
  419.     End Sub
  420.     Public Sub AddToRequests(ByVal Pname As String, ByVal Amount As Double, ByVal SName As String)
  421.         If My.Computer.FileSystem.DirectoryExists(RequestsPath & "\" & Pname) = False Then
  422.             My.Computer.FileSystem.CreateDirectory(RequestsPath & "\" & Pname)
  423.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\amount.dat", 0, False, System.Text.Encoding.GetEncoding(0))
  424.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\customers.dat", "", False, System.Text.Encoding.GetEncoding(0))
  425.             My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\stores.dat", "", False, System.Text.Encoding.GetEncoding(0))
  426.         End If
  427.         Dim LastAmount As Double = Val(My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\amount.dat", System.Text.Encoding.GetEncoding(0)))
  428.         Dim LastC As String = My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\customers.dat", System.Text.Encoding.GetEncoding(0))
  429.         Dim LastS As String = My.Computer.FileSystem.ReadAllText(RequestsPath & "\" & Pname & "\stores.dat", System.Text.Encoding.GetEncoding(0))
  430.         LastAmount += Amount
  431.         If LastC.Contains(NewSellCusTXT.Text) = False Then LastC = LastC & "," & NewSellCusTXT.Text
  432.         If LastS.Contains(SName) = False Then LastS = LastS & "," & SName
  433.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\amount.dat", LastAmount, False, System.Text.Encoding.GetEncoding(0))
  434.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\customers.dat", LastC, False, System.Text.Encoding.GetEncoding(0))
  435.         My.Computer.FileSystem.WriteAllText(RequestsPath & "\" & Pname & "\stores.dat", LastS, False, System.Text.Encoding.GetEncoding(0))
  436.         'write to customer path requesting info :
  437.         'by loading req dirs and compare files .
  438.         MsgBox("كمية ال" & Pname & " المطلوب بيعها غير متوفرة في مخزن " & SName & " حالياً ، لقد تمت إضافة الطلب إلى قائمة طلبات السلع غير المتوفرة.")
  439.     End Sub
  440.     Private Sub NewSellPayWayTXT_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewSellPayWayTXT.SelectedIndexChanged
  441.         If NewSellPayWayTXT.Text = "دين" Then
  442.             NewSellPayAmountTXT.Enabled = False
  443.             NewSellPayAmountTXT.Text = TotalPayment.Tag
  444.         Else
  445.             NewSellPayAmountTXT.Enabled = True
  446.         End If
  447.     End Sub
  448.     Private Sub DelBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DelBTN.Click
  449.         If LV.SelectedItems.Count > 0 Then
  450.             LV.Items.Remove(LV.FocusedItem)
  451.             If LV.Items.Count < 1 Then
  452.                 ZeroingValues()
  453.             End If
  454.         End If
  455.     End Sub
  456.     Private Sub NewSellCusTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles NewSellCusTXT.KeyDown
  457.         If e.KeyCode = Keys.Enter Then NewSellProNameTXT.Select()
  458.     End Sub
  459.     Private Sub StoreNameTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StoreNameTXT.KeyDown
  460.         If e.KeyCode = Keys.Enter Then AddNewBTN.Select()
  461.     End Sub
  462. 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.