0% found this document useful (0 votes)
44 views7 pages

Form1 Liniefactura Factura Liniefactura

This document defines classes and methods for working with invoices and calculating values like total price, VAT, etc. It includes a LinieFactura class to represent invoice lines, a Factura class to represent invoices, and methods within Factura to calculate totals. It also shows how to add invoice lines to a collection and display invoice values.

Uploaded by

Adam Larisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views7 pages

Form1 Liniefactura Factura Liniefactura

This document defines classes and methods for working with invoices and calculating values like total price, VAT, etc. It includes a LinieFactura class to represent invoice lines, a Factura class to represent invoices, and methods within Factura to calculate totals. It also shows how to add invoice lines to a collection and display invoice values.

Uploaded by

Adam Larisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Public Class Form1

Private OLinie As New LinieFactura


Private OFactura As New Factura
Public Class LinieFactura
Private m_CodProdus As Integer
Private m_DenumireProdus As String
Private m_Cantitate As Decimal
Private m_pret As Decimal
Private m_CotaTVA As Decimal
Public Property codprodus As Integer
Get
Return m_CodProdus
End Get
Set(value As Integer)
m_CodProdus = value
End Set
End Property
Public Property DenumireProdus As String
Get
Return m_DenumireProdus
End Get
Set(value As String)
m_DenumireProdus = value
End Set
End Property
Public Property Cantitate As Decimal
Get
Return m_Cantitate
End Get
Set(value As Decimal)
m_Cantitate = value
End Set
End Property
Public Property Pret As Decimal
Get
Return m_pret
End Get
Set(value As Decimal)
m_pret = value
End Set
End Property
Public Property CotaTVA As Decimal
Get
Return m_CotaTVA
End Get

Set(value As Decimal)
m_CotaTVA = value
End Set
End Property
End Class
Public Class Factura
Private m_NrFactura As Integer
Private m_DenTerti As String
Private m_DenEmitent As String
Private m_DataEmiterii As Date
'Definire colectie
Public ColLiniiFactura As New ArrayList
Public Property NrFactura As Integer
Get
Return m_NrFactura
End Get
Set(value As Integer)
m_NrFactura = value
End Set
End Property
Public Function CalculValoareFactura() As Decimal
Dim TotalValoare As Decimal
TotalValoare = 0
'Parcurgerea colectiei
For Each UnProdus As LinieFactura In ColLiniiFactura
TotalValoare = TotalValoare + UnProdus.Cantitate * UnProdus.Pret
Next
Return TotalValoare
End Function
Public Function CalculTvaFactura() As Decimal
Dim TotalTva As Decimal
TotalTva = 0
'Parcurgerea colectiei
For Each a As LinieFactura In ColLiniiFactura
TotalTva = TotalTva + a.Cantitate * a.Pret * a.CotaTVA
Next
Return TotalTva
End Function
Public Function TotalFactura() As Decimal
Return CalculValoareFactura() + CalculTvaFactura()
End Function
End Class
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Preluare OLinie
OLinie.codprodus = InputBox("Tastati cod produs ")
OLinie.DenumireProdus = InputBox("Tastati denumire produs ")
OLinie.Cantitate = InputBox("Tastati cantitate ")
OLinie.Pret = InputBox("Tastati Pret ")
OLinie.CotaTVA = InputBox("Tastati cota tva ")
'Adaug linie in colectie
OFactura.ColLiniiFactura.Add(OLinie)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


MessageBox.Show("In factura Nr." & OFactura.NrFactura & "Avem ")
MessageBox.Show(" Total Valoare = " & OFactura.CalculValoareFactura & " Tva = " &
OFactura.CalculTvaFactura & " Total Factura = " & OFactura.TotalFactura)
End Sub
End Class

Public Class Form1


Private Studenti(3) As String
Private sSirTest As String = "Piata Romana Nr.9"
Private iNumarLitere As Integer
Private iNumarCifre As Integer
Private iNumarSpatii As Integer
Private iNumarSemnePunctuatie As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Studenti(0) = "Alexandra"
Studenti(1) = "Catalina"
Studenti(2) = "Ileana"
Studenti(3) = "Mihaela"
'MessageBox.Show(String.Compare("Alexandra", "Alexandra"))
'MessageBox.Show(String.Concat("Alexandra", ",", "Catalina"))
MessageBox.Show(String.Join(";", Studenti))
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim sNume As String = "Alexandra"
' MessageBox.Show(sNume.CompareTo("Catalina"))
'MessageBox.Show(sNume.IndexOf("x"c))
' MessageBox.Show(sNume.IndexOfAny("vv"))
' MessageBox.Show(sNume.Insert(9, " Ionescu"))
' MessageBox.Show(sNume.Lenght)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
MessageBox.Show(Char.IsLetter("3"c))
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
iNumarCifre = 0
iNumarLitere = 0
iNumarSpatii = 0
iNumarSemnePunctuatie = 0
For i = 0 To sSirTest.Length - 1
If Char.IsLetter(sSirTest.Substring(i, 1)) Then
iNumarLitere = iNumarLitere + 1
End If
If Char.IsNumber(sSirTest.Substring(i, 1)) Then

iNumarCifre = iNumarCifre + 1
End If
If Char.IsWhiteSpace(sSirTest.Substring(i, 1)) Then
iNumarSpatii = iNumarSpatii + 1
End If
If Char.IsPunctuation(sSirTest.Substring(i, 1)) Then
iNumarSemnePunctuatie = iNumarSemnePunctuatie + 1
End If
Next
MessageBox.Show(" Litere=" & iNumarLitere & " cifre=" & iNumarCifre & " Spatii=" & iNumarSpatii &
" Semne de punctuatie" & iNumarSemnePunctuatie)
End Sub
End Class

pentru determinarea varstei


Public Class Form1
'Definire variabile
Private dDataNasterii As Date
Private dDataCurenta As Date
Private Rezultat As Integer
'Definire obiect
Private OPersoana As New Persoana

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


dDataCurenta = Now
' MessageBox.Show("Data curenta este=" & dDataCurenta)
dDataNasterii = InputBox("Tastati data nasterii")
Rezultat = VarstaAni(dDataNasterii, dDataCurenta)
MessageBox.Show("Data curenta=" & dDataCurenta & "Data nasterii=" & dDataNasterii & "Varsta="
& Rezultat)
End Sub
'Definire functie
Public Function VarstaAni(ByVal Dn As Date, ByVal Dc As Date)
VarstaAni = 0
If Dn.Month < Dc.Month Then
VarstaAni = Dc.Year - Dn.Year
End If
If Dn.Month = Dc.Month Then
If Dn.Day <= Dc.Day Then
VarstaAni = Dc.Year - Dc.Year
Else
VarstaAni = Dc.Year - Dn.Year - 1
End If
End If
If Dn.Month > Dc.Month Then
VarstaAni = Dc.Year - Dn.Year - 1
End If
End Function
'Definire clasa
Public Class Persoana
'Definire atribute
Private m_Nume As String
Private m_DataNasterii As Date
'Definire proprietati
Public Property DataNasterii As Date
Get

DataNasterii = m_DataNasterii
End Get
Set(value As Date)
If value <= Now Then
m_DataNasterii = value
Else
MessageBox.Show("Data nasterii este incorecta")
End If
End Set
End Property
Public Property Nume As String
Get
Nume = m_Nume
End Get
Set(value As String)
m_Nume = value
End Set
End Property
Public Function VarstaAni(ByVal Dn As Date, ByVal Dc As Date)
VarstaAni = 0
If Dn.Month < Dc.Month Then
VarstaAni = Dc.Year - Dn.Year
End If
If Dn.Month = Dc.Month Then
If Dn.Day <= Dc.Day Then
VarstaAni = Dc.Year - Dc.Year
Else
VarstaAni = Dc.Year - Dn.Year - 1
End If
End If
If Dn.Month > Dc.Month Then
VarstaAni = Dc.Year - Dn.Year - 1
End If
End Function
End Class
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
OPersoana.DataNasterii = InputBox("Tastati data nasterii")
OPersoana.Nume = InputBox("Tastati nume")
MessageBox.Show(" Pentru persoana " & OPersoana.Nume & " Varsta=" &
OPersoana.VarstaAni(OPersoana.DataNasterii, Now))
End Sub
End Class

You might also like