У меня большие трудности с пониманием этой концепции: в настоящее время мы представляем нашим представителям раскрывающееся меню на экране заказа, которое предоставит им несколько вариантов дополнений в зависимости от продукта, добавленного к заказу в строке. до. Проблема заключается в том, что они могут выбрать только один из вариантов, и позиция записывается в заказ, а представители затем не могут выбрать второе дополнение для добавления в заказ (в случае, если клиент хотел добавить оба варианта). -ons вместо одного). Приведенный ниже код является работой программиста, работавшего до меня, поэтому я не уверен, хорошо ли он написан, поскольку Powerscript для меня нов.
Предостережения - это должно оставаться раскрывающимся списком, и я не могу просто добавить второе дополнение в фоновом режиме. Для правильной работы системы заказов выбранные дополнения должны идти сразу после основного товара, один за другим. Я также не могу добавить «комплектный» продукт, так как это испортит отчеты о продажах.
String contact_type, contact_name
Long contact_no, ll_child_row
long product_no, addon_product_no
string addon
string null_string
string promo_key
string addon_edition_code
int qty
real price
DataWindowChild contact_child
AcceptText()
If GetColumnName() = 'attn_freeform' Then
AcceptText()
GetChild('attn_freeform', contact_child)
ll_child_row = contact_child.GetRow()
If ll_child_row > 0 Then
contact_name = contact_child.GetItemString(ll_child_row, 'contact_name')
If data = contact_name Then
contact_type = contact_child.GetItemString(ll_child_row, 'tar_contact_type')
contact_no = contact_child.GetItemNumber(ll_child_row, 'tar_contact_no')
SetItem(row, "ship2_tar_contact_type", contact_type)
SetItem(row, "ship2_tar_contact_no", contact_no)
Else
SetItem(row, "ship2_tar_contact_type", '')
SetItem(row, "ship2_tar_contact_no", -1)
End If
Else
SetItem(row, "ship2_tar_contact_type", '')
SetItem(row, "ship2_tar_contact_no", -1)
End If
End If
if GetColumnName() = 'quantity' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetItem(row + 1,"quantity",integer(data))
AcceptText()
end if
if GetColumnName() = 'package_no' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetItem(row + 1,"package_no",dw_order_detail.getitemnumber(row,"package_no"))
AcceptText()
end if
if GetColumnName() = 'attn_freeform' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetItem(row + 1,"attn_freeform",data)
AcceptText()
end if
if GetColumnName() = 'promo_key' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetItem(row + 1,"promo_key",data)
AcceptText()
end if
if GetColumnName() = 'order_type' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetItem(row + 1,"order_type",dw_order_detail.getitemstring(row,"order_type"))
end if
if GetColumnName() = 'product_no' and not isnull(dw_order_detail.GetItemString(row,"name_1")) then
SetNull(null_string)
dw_order_detail.deleterow(row + 1)
dw_order_detail.SetItem(row,"name_1",null_string)
end if
product_no = 0
if GetColumnName() = 'product_no' and isnull(dw_order_detail.GetItemString(row,"name_1")) then
product_no = dw_order_detail.GetItemNumber(row,'product_no')
int checkAddon
Select isnull(count(*),0) into :checkAddon From product p JOIN mag_addons t ON p.edition_code = t.primary_edition and p.product_no = :product_no;
if checkAddon > 0 then
dw_order_detail.SetItem(row, "teach_12",0)
end if
end if
promo_key = dw_order_detail.getitemstring(row,"promo_key")
qty = dw_order_detail.getitemnumber(row,"quantity")
AcceptText()
if GetColumnName() = 'name_1' then //the dropdown for addon selection appears here
long ll_row, ll_inserted_row
SetNull(null_string)
product_no = 0
product_no = dw_order_detail.GetItemNumber(row,'product_no')
addon = dw_order_detail.GetItemString(row,"name_1") //this sets the name of the addon
if isnull(addon) or addon = "Select Add On..." then
return
end if
Select p.product_no, t.add_on_edition into :addon_product_no, :addon_edition_code from product p JOIN mag_addons t ON p.edition_code = t.add_on_edition and p.description = :addon JOIN product d ON t.primary_edition = d.edition_code;
if row + 1 < dw_order_detail.RowCount() then
if dw_order_detail.GetItemString(row + 1,'addondesc') = addon then
return
end if
end if
if product_no >= 1 then
SELECT price INTO :price FROM dbo.get_price(:promo_key,:addon_edition_code,:qty, :vg_project_id);
if price = 0 then
price = .99
end if
ll_row = dw_order_detail.GetRow()
ll_inserted_row = dw_order_detail.InsertRow(row + 1)
SetItem(row + 1,"order_no",dw_order_detail.getitemnumber(row,"order_no"))
SetItem(row + 1,"line_item_no",dw_order_detail.getitemnumber(row,"line_item_no") + 1)
SetItem(row + 1,"status_code",dw_order_detail.getitemstring(row,"status_code"))
SetItem(row + 1,"ship2_tar_contact_type",dw_order_detail.getitemstring(row,"ship2_tar_contact_type"))
SetItem(row + 1,"ship2_tar_contact_no",dw_order_detail.getitemnumber(row,"ship2_tar_contact_no"))
SetItem(row + 1,"attn_freeform",dw_order_detail.getitemstring(row,"attn_freeform"))
SetItem(row + 1,"promo_key",promo_key)
SetItem(row + 1,"product_no",addon_product_no)
SetItem(row + 1,"quantity",dw_order_detail.getitemnumber(row,"quantity"))
SetItem(row + 1,"price",price)
SetItem(row + 1,"price_1",price)
SetItem(row + 1,"package_no",dw_order_detail.getitemnumber(row,"package_no"))
SetItem(row + 1,"order_type",dw_order_detail.getitemstring(row,"order_type"))
SetItem(row + 1,"shipping_rate",dw_order_detail.getitemnumber(row,"shipping_rate"))
SetItem(row + 1,"sales_tax_rate",dw_order_detail.getitemnumber(row,"sales_tax_rate"))
SetItem(row + 1,"ship2_tar_acct_type",dw_order_detail.getitemstring(row,"ship2_tar_acct_type"))
SetItem(row + 1,"ship2_tar_acct_no",dw_order_detail.getitemnumber(row,"ship2_tar_acct_no"))
SetItem(row + 1,"jt_id",dw_order_detail.getitemnumber(row,"jt_id"))
SetItem(row + 1,"year_began_teach",dw_order_detail.getitemnumber(row,"year_began_teach"))
SetItem(row + 1,"preferred_email",dw_order_detail.getitemstring(row,"preferred_email"))
SetItem(row + 1,"email",dw_order_detail.getitemstring(row,"email"))
SetItem(row + 1,"addondesc",dw_order_detail.getitemstring(row,"name_1"))
SetItem(row,"teach_12",1)
SetItem(row + 1,"teach_12",2)
dw_order_detail.AcceptText()
end if
dw_order_detail.ScrollToRow(ll_inserted_row)
dw_order_detail.SetFocus()
end if
dw_order_detail.AcceptText()
itemchanged
- person soundwave   schedule 03.09.2015accepttext
, что нормально, но свойствоdwo.name
не существует, в документации Sybase PowerBuilder 11.5 рекомендуется использоватьdwo.GetColumnName
- person soundwave   schedule 08.09.2015itemchanged
, но.name
выдает ошибкуIncompatible property name for type dw_order_detail
- person soundwave   schedule 08.09.2015dwo
является общим и коррелирует сdw_order_detail
, тогда как это простоdwo
- person soundwave   schedule 08.09.2015