If rec1.EOF Then i = i + 1 .Cells(i, 1) = rec!sklad .Cells(i, 2) = rec!skln_cd .Cells(i, 3) = TD(ddd1) .Cells(i, 4) = 0 If rec!skldcs_SumExt <> 0 And rec!bonus = 1 Then .Cells(i, 5) = 0 ElseIf rec!skldcs_SumExt = 0 And rec!bonus = 1 Then .Cells(i, 5) = -1 .Cells(i, 6) = 0 .Cells(i, 7) = qtn .Cells(i, 8) = 0 .Cells(i, 9) = 0 .Cells(i, 10) = qtn .Cells(i, 11) = smn .Cells(i, 12) = 0 .Cells(i, 13) = 0 .Cells(i, 14) = smn Else If ddd1 <> rec1!dat Then i = i + 1 .Cells(i, 1) = rec!sklad .Cells(i, 2) = rec!skln_cd .Cells(i, 3) = TD(ddd1) .Cells(i, 4) = 0 If rec!skldcs_SumExt <> 0 And rec!bonus = 1 Then .Cells(i, 5) = 0 ElseIf rec!skldcs_SumExt = 0 And rec!bonus = 1 Then .Cells(i, 5) = -1 .Cells(i, 6) = 0 .Cells(i, 7) = qtn .Cells(i, 8) = 0 .Cells(i, 9) = 0 .Cells(i, 10) = qtn .Cells(i, 11) = smn .Cells(i, 12) = 0 .Cells(i, 13) = 0 .Cells(i, 14) = smn Else i = i + 1 .Cells(i, 1) = rec!sklad .Cells(i, 2) = rec!skln_cd .Cells(i, 3) = TD(rec1!dat) .Cells(i, 4) = 0 If (rec!skldcs_SumExt <> 0) And (rec!bonus = 1) Then .Cells(i, 5) = 0 ElseIf (rec!skldcs_SumExt = 0) And (rec!bonus = 1) Then .Cells(i, 5) = -1 .Cells(i, 6) = 0 .Cells(i, 7) = qtn .Cells(i, 8) = rec1!prih .Cells(i, 9) = rec1!rash qtn = qtn + rec1!prih - rec1!rash .Cells(i, 10) = qtn .Cells(i, 11) = smn .Cells(i, 12) = rec1!prih * rec!sklkrt_cn .Cells(i, 13) = rec1!rash * rec!sklkrt_cn smn = qtn * rec!sklkrt_cn .Cells(i, 14) = smn rec1.MoveNext End If End If |