![]() ![]() |
30.01.2015г. в 21:33ч.
Коментар:
#1
|
|
|
Новак ![]() Група: Потребители Съобщения: 4 Дата на регистрация: 15.08.2009г. Потребител # 7 789 |
Здравейте, Имам една задача да си създам приложение за базата ми данни в Oracle APEX намерих си разни примери, но срещнах едно предизвикателство и тъй като е от друга база данни не мога да използвам точно този код, които много ми харесва как е направен в приложението. Тъй като моята база е с различни наименования и е подредена по много различен начин ми се иска някак си да направя нещо подобно, но страшно много ми куца кода. Прикачения файл е как изглежда кода при пуснато приложение. Това е кода, които е за Избиране на предмети към определен Клиент CODE declare
l_customer_id varchar2(30) := :P11_CUSTOMER_ID; begin -- -- display customer information -- sys.htp.p('<div class="demoCustomerInfo">'); if :P11_CUSTOMER_OPTIONS = 'EXISTING' then for x in (select * from demo_customers where customer_id = l_customer_id) loop sys.htp.p('<div class="demoCustomerInfo">'); sys.htp.p('<strong>Customer:</strong>'); sys.htp.p('<p>'); sys.htp.p(apex_escape.html(x.cust_first_name) || ' ' || apex_escape.html(x.cust_last_name) || '<br />'); sys.htp.p(apex_escape.html(x.cust_street_address1) || '<br />'); if x.cust_street_address2 is not null then sys.htp.p(apex_escape.html(x.cust_street_address2) || '<br />'); end if; sys.htp.p(apex_escape.html(x.cust_city) || ', ' || apex_escape.html(x.cust_state) || ' ' || apex_escape.html(x.cust_postal_code)); sys.htp.p('</p>'); end loop; else sys.htp.p('<strong>Customer:</strong>'); sys.htp.p('<p>'); sys.htp.p(apex_escape.html(:P11_CUST_FIRST_NAME) || ' ' || apex_escape.html(:P11_CUST_LAST_NAME) || '<br />'); sys.htp.p(apex_escape.html(:P11_CUST_STREET_ADDRESS1) || '<br />'); if :P11_CUST_STREET_ADDRESS2 is not null then sys.htp.p(apex_escape.html(:P11_CUST_STREET_ADDRESS2) || '<br />'); end if; sys.htp.p(apex_escape.html(:P11_CUST_CITY) || ', ' || apex_escape.html(:P11_CUST_STATE) || ' ' || apex_escape.html(:P11_CUST_POSTAL_CODE)); sys.htp.p('</p>'); end if; sys.htp.p('</div>'); -- -- display products -- sys.htp.p('<div class="demoProducts" >'); sys.htp.p('<table width="100%" cellspacing="0" cellpadding="0" border="0"> <thead> <tr><th class="left">Product</th><th>Price</th><th></th></tr> </thead> <tbody>'); for c1 in (select product_id, product_name, list_price, 'Add to Cart' add_to_order from demo_product_info where product_avail = 'Y' order by product_name) loop sys.htp.p('<tr><td class="left"><a href="java script:popUp2('''||apex_util.prepare_url('f?p=&APP_ID.:20:'||:app_session||':ADD:::P20_PRODUCT_ID:'|| apex_escape.html(c1.product_id))||''',''700'',''400'');">' || apex_escape.html(c1.product_name)||'</a></td><td>'||trim(to_char(c1.list_price,'999G999G990D00'))|| '</td><td><a href="'||apex_util.prepare_url('f?p=&APP_ID.:12:'||:app_session||':ADD:::P12_PRODUCT_ID:'|| c1.product_id)||'" class="uButton uAltButton iconButton plus"><span>Add<i class="iR"></i></span></a></td></tr>'); end loop; sys.htp.p('</tbody></table>'); sys.htp.p('</div>'); -- -- display current order -- sys.htp.p('<div class="demoProducts" >'); sys.htp.p('<table width="100%" cellspacing="0" cellpadding="0" border="0"> <thead> <tr><th class="left">Current Order</th></tr> </thead> </table> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody>'); declare c number := 0; t number := 0; begin -- loop over cart values for c1 in (select c001 pid, c002 i, to_number(c003) p, count(c002) q, sum(c003) ep, 'Remove' remove from apex_collections where collection_name = 'ORDER' group by c001, c002, c003 order by c002) loop sys.htp.p('<div class="sideCartItem"><a href="'|| apex_util.prepare_url('f?p=&APP_ID.:12:&SESSION.:REMOVE:::P12_PRODUCT_ID:'||apex_escape.html(c1.pid))|| '"><img src="#IMAGE_PREFIX#delete.gif" alt="Remove from cart" title="Remove from cart" /></a> <a href="java script:popUp2('''||apex_util.prepare_url('f?p=&APP_ID.:20:'||:app_session||':ADD:::P20_PRODUCT_ID:'|| apex_escape.html(c1.pid))||''',''700'',''400'');">'||apex_escape.html(c1.i)||'</a> <span>'||trim(to_char(c1.p,'$999G999G999D00'))||'</span> <span>Quantity: '||c1.q||'</span> <span class="subtotal">Subtotal: '||trim(to_char(c1.ep,'$999G999G999D00'))||'</span> </div>'); c := c + 1; t := t + c1.ep; end loop; sys.htp.p('</tbody></table>'); if c > 0 then sys.htp.p('<div class="sideCartTotal"> <p>Items: <span>'||c||'</span></p> <p class="sideCartTotal">Total: <span>'||trim(to_char(t,'$999G999G999D00'))||'</span></p> </div>'); else sys.htp.p('<div class="alertMessage info" style="margin-top: 8px;">'); sys.htp.p('<img src="#IMAGE_PREFIX#f_spacer.gif">'); sys.htp.p('<div class="innerMessage">'); sys.htp.p('<h3>Note</h3>'); sys.htp.p('<p>You have no items in your current order.</p>'); sys.htp.p('</div>'); sys.htp.p('</div>'); end if; end; sys.htp.p('</div>'); end;
Прикачени файлове
|
|
|
![]() ![]() |