| Old | Old — C:\pb-diff-demo\old\w_order_entry.srw |
|---|---|
| New | New — C:\pb-diff-demo\new\w_order_entry.srw |
| File type | Window |
| Items | 7 |
| New | 2 |
| Modified | 4 |
| Deleted | 1 |
| Unchanged | 0 |
NewModifiedDeleted
| Item | Kind | Status | Added | Deleted | Modified |
|---|---|---|---|---|---|
| Instance Variables | Instance variables | Modified | 1 | 0 | 0 |
| Prototypes | Prototypes | Modified | 1 | 0 | 1 |
| Functions / wf_total (decimal ad_pct) | Function | Modified | 5 | 1 | 2 |
| Functions / wf_preview () | Subroutine | Deleted | 0 | 4 | 0 |
| Functions / wf_cancelled (long al_row) | Function | New | 4 | 0 | 0 |
| Functions / wf_show_total (decimal ad_total) | Subroutine | New | 10 | 0 | 0 |
| Controls / cb_save (commandbutton) / Events / clicked | Event | Modified | 0 | 0 | 1 |
| 1 | type variables | 1 | type variables | |
| 2 | decimal{2} id_tax = 0.22 | 2 | decimal{2} id_tax = 0.22 | |
| + | 3 | decimal{2} id_max_pct = 30 | ||
| 3 | long il_order | 4 | long il_order | |
| 4 | end variables | 5 | end variables |
| 1 | forward prototypes | 1 | forward prototypes | |
| 2 | public function decimal wf_total (decimal ad_pct) | 2 | public function decimal wf_total (decimal ad_pct) | |
| 3 | public function integer wf_save () | 3 | public function integer wf_save () | |
| 4 | ~ | public subroutine wf_preview () | 4 | public function boolean wf_cancelled (long al_row) |
| + | 5 | public subroutine wf_show_total (decimal ad_total) | ||
| 5 | end prototypes | 6 | end prototypes |
public function decimal wf_total (decimal ad_pct)
| 1 | public function decimal wf_total (decimal ad_pct); | 1 | public function decimal wf_total (decimal ad_pct); | |
| 2 | // Order total after discount and tax. | 2 | // Order total after discount and tax. | |
| 3 | decimal{2} ld_sub, ld_disc, ld_total | 3 | decimal{2} ld_sub, ld_disc, ld_total | |
| 4 | long ll_row, ll_rows | 4 | long ll_row, ll_rows | |
| 5 | 5 | |||
| + | 6 | if ad_pct < 0 or ad_pct > id_max_pct then | ||
| + | 7 | ad_pct = 0 | ||
| + | 8 | end if | ||
| + | 9 | |||
| 6 | ll_rows = dw_lines.RowCount() | 10 | ll_rows = dw_lines.RowCount() | |
| 7 | for ll_row = 1 to ll_rows | 11 | for ll_row = 1 to ll_rows | |
| + | 12 | if wf_cancelled(ll_row) then continue | ||
| 8 | ld_sub += dw_lines.GetItemDecimal(ll_row, 5) | 13 | ld_sub += dw_lines.GetItemDecimal(ll_row, 5) | |
| 9 | next | 14 | next | |
| 10 | 15 | |||
| 11 | ld_disc = ld_sub * ad_pct / 100 | 16 | ld_disc = ld_sub * ad_pct / 100 | |
| 12 | ld_total = (ld_sub - ld_disc) * (1 + id_tax) | 17 | ld_total = (ld_sub - ld_disc) * (1 + id_tax) | |
| 13 | ~ | ld_total = Truncate(ld_total, 2) | 18 | ld_total = Round(ld_total, 2) |
| 14 | - | MessageBox("debug", String(ld_total)) | ||
| 15 | 19 | |||
| 16 | ~ | st_total.Text = String(ld_total, "#,##0.00") | 20 | wf_show_total(ld_total) |
| 17 | return ld_total | 21 | return ld_total | |
| 18 | end function | 22 | end function |
public subroutine wf_preview ()
| 1 | - | public subroutine wf_preview (); | ||
| 2 | - | // Shows the lines in print preview. | ||
| 3 | - | dw_lines.Modify("DataWindow.Print.Preview=Yes") | ||
| 4 | - | end subroutine |
public function boolean wf_cancelled (long al_row)
| + | 1 | public function boolean wf_cancelled (long al_row); | ||
| + | 2 | // True when the order line is cancelled. | ||
| + | 3 | return dw_lines.GetItemString(al_row, 9) = "X" | ||
| + | 4 | end function |
public subroutine wf_show_total (decimal ad_total)
| + | 1 | public subroutine wf_show_total (decimal ad_total); | ||
| + | 2 | // Shows the total, in red when it is zero. | ||
| + | 3 | st_total.Text = String(ad_total, "#,##0.00") | ||
| + | 4 | |||
| + | 5 | if ad_total = 0 then | ||
| + | 6 | st_total.TextColor = RGB(192, 0, 0) | ||
| + | 7 | else | ||
| + | 8 | st_total.TextColor = RGB(0, 0, 0) | ||
| + | 9 | end if | ||
| + | 10 | end subroutine |
event clicked
| 1 | event clicked;if wf_save() = 1 then | 1 | event clicked;if wf_save() = 1 then | |
| 2 | ~ | MessageBox("Order Entry", "Order saved.") | 2 | MessageBox("Order Entry", "Order " + String(il_order) + " saved.") |
| 3 | end if | 3 | end if | |
| 4 | end event | 4 | end event |