64 lines
1.2 KiB
OpenEdge ABL
64 lines
1.2 KiB
OpenEdge ABL
|
VERSION 1.0 CLASS
|
||
|
BEGIN
|
||
|
MultiUse = -1 'True
|
||
|
END
|
||
|
Attribute VB_Name = "months"
|
||
|
Attribute VB_GlobalNameSpace = False
|
||
|
Attribute VB_Creatable = False
|
||
|
Attribute VB_PredeclaredId = True
|
||
|
Attribute VB_Exposed = True
|
||
|
Option Explicit
|
||
|
|
||
|
Private x As New TheBigOne
|
||
|
Private units() As Variant
|
||
|
Private price() As Variant
|
||
|
Private sales() As Variant
|
||
|
Private dumping As Boolean
|
||
|
|
||
|
|
||
|
Sub get_sheet()
|
||
|
|
||
|
units = Range("B6:F17")
|
||
|
price = Range("H6:L17")
|
||
|
sales = Range("N6:R17")
|
||
|
|
||
|
End Sub
|
||
|
|
||
|
Sub set_sheet()
|
||
|
|
||
|
dumping = True
|
||
|
|
||
|
Range("B6:F17") = units
|
||
|
Range("H6:L17") = price
|
||
|
Range("N6:R17") = sales
|
||
|
|
||
|
dumping = False
|
||
|
|
||
|
End Sub
|
||
|
|
||
|
Sub calc_adjust_vp()
|
||
|
|
||
|
Dim i As Integer
|
||
|
Call Me.get_sheet
|
||
|
|
||
|
For i = 1 To 12
|
||
|
If units(i, 4) = "" Then units(i, 4) = 0
|
||
|
If price(i, 4) = "" Then price(i, 4) = 0
|
||
|
units(i, 4) = units(i, 5) - (units(i, 2) + units(i, 3))
|
||
|
price(i, 4) = price(i, 5) - (price(i, 2) + price(i, 3))
|
||
|
sales(i, 5) = units(i, 5) * price(i, 5)
|
||
|
sales(i, 4) = sales(i, 5) - (sales(i, 2) + sales(i, 3))
|
||
|
Next i
|
||
|
|
||
|
set_sheet
|
||
|
|
||
|
|
||
|
End Sub
|
||
|
|
||
|
|
||
|
Private Sub Worksheet_Change(ByVal Target As Range)
|
||
|
|
||
|
If Not dumping Then Call Me.calc_adjust_vp
|
||
|
|
||
|
End Sub
|