1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| Option Explicit
Private Sub cboChoice_Change()
lblClientName.Caption = cboChoice.Value
GetToInvoiceHT
End Sub
Private Sub cmdToInvoice_Click()
mToInvoice.SaveInvoice tboInvoiceRef.Value, lblInvoiceDate.Caption, lblClientName.Caption, lblSigmaHT.Caption, lblPaid.Caption
SetInvoiced
Unload Me
ShowFormToInvoice
End Sub
Function SetCboChoiceSource()
Dim ligne As Integer: ligne = 2
While (ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value <> "")
If ThisWorkbook.Worksheets("InPuts").Cells(ligne, 5).Value = 1 Then
cboChoice.AddItem (ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value)
End If
ligne = ligne + 1
Wend
End Function
Function GetToInvoiceHT()
Dim ligne As Integer: ligne = 2
Dim sigma As Currency: sigma = 0
While (ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value <> "")
If ThisWorkbook.Worksheets("InPuts").Cells(ligne, 5).Value = 1 And ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value = lblClientName.Caption Then
sigma = sigma + (ThisWorkbook.Worksheets("InPuts").Cells(ligne, 8).Value)
End If
ligne = ligne + 1
lblSigmaHT.Caption = sigma
Wend
End Function
Function SetInvoiced()
Dim ligne As Integer: ligne = 2
While (ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value <> "")
If ThisWorkbook.Worksheets("InPuts").Cells(ligne, 5).Value = 1 And ThisWorkbook.Worksheets("InPuts").Cells(ligne, 1).Value = lblClientName.Caption Then
ThisWorkbook.Worksheets("InPuts").Cells(ligne, 5).Value = 0
ThisWorkbook.Worksheets("InPuts").Cells(ligne, 6).Value = 1
ThisWorkbook.Worksheets("InPuts").Cells(ligne, 11).Value = tboInvoiceRef.Value
End If
ligne = ligne + 1
Wend
End Function
Function PrepareForm()
SetCboChoiceSource
cboChoice.Value = vbNullString
tboInvoiceRef.Value = vbNullString
lblInvoiceDate.Caption = Date
lblClientName.Caption = vbNullString
lblSigmaHT.Caption = vbNullString
lblPaid.Caption = 0
End Function |
Partager