Nombas Logo: Simplicity and Power Through Scripting

Scripting

Products

Purchase

Download

Support

Company

Nombas > Products > ScriptEase ISDK > Device JavaScript > In Action > XML Code

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE app SYSTEM "jargonapp.dtd">
   
<app name="cust" initTasklist="init" elementCount="32">
  <frame name="frame0" title="Sports 2000 Customer Setup">
    <property name="layout"><layout layoutType="GridBag"/></property>
    <label name="label0" text="Cust. No.">
      <gbc/>
    </label>
    <textfield name="tCustNum" columns="5">
      <gbc gridX="1" rightInset="5"/>
    </textfield>
    <button name="bDisplay" label="Display" isSeparated="false">
      <gbc gridX="2" gridW="2" bottomInset="2"/>
      <ActionEvent taskNames="Display"/>
    </button>
    <label name="label1" text="Cust Name">
      <gbc gridY="1"/>
    </label>
    <textfield name="tCustName" columns="30">
      <gbc gridX="1" gridY="1" gridW="3"/>
    </textfield>
    <label name="label2" text="Address">
      <gbc gridY="2"/>
    </label>
    <textfield name="tCustAddr1" columns="30">
      <gbc gridX="1" gridY="2" gridW="3"/>
    </textfield>
    <label name="label3" text="City">
      <gbc gridY="3"/>
    </label>
    <textfield name="tCustCity" columns="30">
      <gbc gridX="1" gridY="3" gridW="3"/>
    </textfield>
    <label name="label4" text="State-Zip">
      <gbc gridY="4"/>
    </label>
    <textfield name="tCustState" columns="8">
      <gbc gridX="1" gridY="4" gridW="2"/>
    </textfield>
    <textfield name="tCustZip">
      <gbc gridX="3" gridY="4"/>
    </textfield>
    <button name="bFirst" label="First" isSeparated="false">
      <gbc gridY="8" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="First"/>
    </button>
    <button name="bSubmit" label="Submit" isSeparated="false">
      <gbc gridX="2" gridY="8" gridW="2" topInset="2"/>
      <ActionEvent taskNames="Submit"/>
    </button>
    <button name="bPrev" label="Prev." isSeparated="false">
      <gbc gridY="9" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="Prev"/>
    </button>
    <button name="bClear" label="Clear" isSeparated="false">
      <gbc gridX="2" gridY="9" gridW="2" topInset="2"/>
      <ActionEvent taskNames="DoClear"/>
    </button>
    <button name="bNext" label="Next" isSeparated="false">
      <gbc gridY="10" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="Next"/>
    </button>
    <button name="bMore" label="More" isSeparated="false">
      <gbc gridX="2" gridY="10" gridW="2" topInset="2"/>
      <ActionEvent taskNames="MoreData"/>
    </button>
    <button name="bLast" label="Last" isSeparated="false">
      <gbc gridY="11" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="Last"/>
    </button>
    <button name="bExit" label="Exit" isSeparated="false">
      <gbc gridX="2" gridY="11" gridW="2" topInset="2"/>
      <ActionEvent taskNames="Exit"/>
    </button>
  </frame>
  
  <frame name="frame1" title="More Customer Data">
    <property name="layout"><layout layoutType="GridBag"/></property>
    <label name="label7" text="Telephone">
      <gbc/>
    </label>
    <textfield name="tCustPhone" columns="30">
      <gbc gridX="1" gridW="3"/>
    </textfield>
    <label name="label6" text="Contact">
      <gbc gridY="1"/>
    </label>
    <textfield name="tCustContact" columns="30">
      <gbc gridX="1" gridY="1" gridW="3"/>
    </textfield>
    <label name="label20" text="Sales Rep.">
      <gbc gridY="2"/>
    </label>
    <textfield name="tRep">
      <gbc gridX="1" gridY="2"/>
    </textfield>
    <label name="label21" text="Rep Name">
      <gbc gridY="3"/>
    </label>
    <textfield name="tRepName" columns="20">
      <gbc gridX="1" gridY="3" gridW="3"/>
    </textfield>
    <button name="bOrders" label="Orders..." isSeparated="false">
      <gbc gridY="5" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="CustOrders"/>
    </button>
    <button name="bBack" label="Back" isSeparated="false">
      <gbc gridY="6" topInset="2" leftInset="2"/>
      <ActionEvent taskNames="MainFrame"/>
    </button>
  </frame>
  
  <frame name="frame2" title="Customer Orders">
    <property name="layout"><layout layoutType="GridBag"/></property>
    <label name="labelOrders" text="Order#    Order Date    Ship Date">
      <gbc gridW="3"/>
    </label>
    <textfield name="tOrdNum1" columns="6">
      <gbc gridY="1"/>
    </textfield>
    <textfield name="tOrdDate1" columns="10">
      <gbc gridX="1" gridY="1" rightInset="5"/>
    </textfield>
    <textfield name="tShipDate1" columns="10">
      <gbc gridX="2" gridY="1"/>
    </textfield>
    <textfield name="tOrdNum2" columns="6">
      <gbc gridY="2"/>
    </textfield>
    <textfield name="tOrdDate2" columns="10">
      <gbc gridX="1" gridY="2" rightInset="5"/>
    </textfield>
    <textfield name="tShipDate2" columns="10">
      <gbc gridX="2" gridY="2"/>
    </textfield>
    <textfield name="tOrdNum3" columns="6">
      <gbc gridY="3"/>
    </textfield>
    <textfield name="tOrdDate3" columns="10">
      <gbc gridX="1" gridY="3" rightInset="5"/>
    </textfield>
    <textfield name="tShipDate3" columns="10">
      <gbc gridX="2" gridY="3"/>
    </textfield>
    <textfield name="tOrdNum4" columns="6">
      <gbc gridY="4"/>
    </textfield>
    <textfield name="tOrdDate4" columns="10">
      <gbc gridX="1" gridY="4" rightInset="5"/>
    </textfield>
    <textfield name="tShipDate4" columns="10">
      <gbc gridX="2" gridY="4"/>
    </textfield>
    <button name="bBack2" label="Back" isSeparated="false">
      <gbc gridY="9" topInset="10"/>
      <ActionEvent taskNames="MoreData"/>
    </button>
    <button name="bNext2" label="Continue" isSeparated="false">
      <gbc gridX="1" gridY="9" topInset="10" leftInset="8"/>
      <ActionEvent taskNames="MoreOrders"/>
    </button>
    <button name="bBack3" label="Home" isSeparated="false">
      <gbc gridX="2" gridY="9" topInset="10" leftInset="2"/>
      <ActionEvent taskNames="MainFrame"/>
    </button>
  </frame>
  
  <script>
    // VSB: 20=AS NEEDED 21=NEVER  22=ALWAYS
    function init() {
        MainFrame();    
    }    
    
    function MsgBox(msg) {
        JSISystem.MessageBox(msg);
    }
  
    function MainFrame() {
        frame0.SetVisible(true);    
        frame0.SetMessage('Please select an action');
    }    
  
    function MoreData() {
        frame1.SetTitle("More Data for Customer " + tCustNum.GetText());
        frame1.SetVisible(true);    
        frame1.SetMessage('Please select an action');
    }        
  
    function ClearOrders() {
        tOrdNum1.SetText("");
        tOrdDate1.SetText("");
        tShipDate1.SetText("");
        tOrdNum2.SetText("");
        tOrdDate2.SetText("");
        tShipDate2.SetText("");
        tOrdNum3.SetText("");
        tOrdDate3.SetText("");
        tShipDate3.SetText("");
        tOrdNum4.SetText("");
        tOrdDate4.SetText("");
        tShipDate4.SetText("");
    }        
  
    function GetOrders(lastOrdNum) {
        rpc.SetRemoteProgram("a5/customers.p");
        rpc.SetRemoteProcedure("getOrders");
        rpc.AddNameValuePair("tCustNum", tCustNum.GetText());
        rpc.AddNameValuePair("lastOrdNum", lastOrdNum);
        rpc.Execute(); 
    }        
  
    function CustOrders() {
	if ( isNaN( parseInt( tCustNum.GetText() ) ) )
	   { MsgBox('Must select a customer');
	     return;
	   }
        frame2.SetTitle("Orders for Customer " + tCustNum.GetText());
        ClearOrders();
        frame2.SetVisible(true);    
        frame2.SetMessage('Click CONTINUE to view orders');
        // GetOrders("0");
    }        
  
    function MoreOrders() {
        lastOrd = tOrdNum4.GetText();
        ClearOrders();
        GetOrders( lastOrd );
    }        
  
    function NotImplMsg() {
        JSISystem.WarningBox("This feature is not yet implemented!");    
    }
    
    function CallRemoteProc(TranType, CustID) {
        rpc.SetRemoteProgram("a5/customers.p");
        rpc.SetRemoteProcedure("getcust");
        rpc.AddNameValuePair("tCustNum", CustID);
        rpc.AddNameValuePair("H-action-type", TranType);
        rpc.Execute(); 
    }
    
    function Submit() {
        rpc.SetRemoteProgram("a5/customers.p");
        rpc.SetRemoteProcedure("setcust");
        rpc.AddNameValuePair("tCustNum", tCustNum.GetText());
        rpc.AddNameValuePair("tCustName", tCustName.GetText());
        rpc.AddNameValuePair("tCustAddr1", tCustAddr1.GetText());
        rpc.AddNameValuePair("tCustCity", tCustCity.GetText());
        rpc.AddNameValuePair("tCustState", tCustState.GetText());
        rpc.AddNameValuePair("tCustZip", tCustZip.GetText());
  
        rpc.AddNameValuePair("tCustPhone", tCustPhone.GetText());
        rpc.AddNameValuePair("tCustContact", tCustContact.GetText());
        rpc.AddNameValuePair("tRep", tRep.GetText());
        rpc.Execute(); 
    }
  
    function Display() {
        CallRemoteProc("get", tCustNum.GetText());        
    }
    
    function Next() {
        CallRemoteProc("next", tCustNum.GetText());                
    }
    
    function Prev() {
        CallRemoteProc("prev", tCustNum.GetText());                        
    }
    
    function First() {
    	CallRemoteProc("first", "");                                
    }
    
    function Last() {
        CallRemoteProc("last", "");                                
    }    
  
    function DoClear() {
        tCustNum.SetText("");
        tCustName.SetText("");
        tCustAddr1.SetText("");
        tCustCity.SetText("");
        tCustState.SetText("");
        tCustZip.SetText("");
        tCustPhone.SetText("");
        tCustContact.SetText("");
        tRep.SetText("");
        tRepName.SetText("");
        // tnOrders.SetText("");
    }
  
    function Exit() {
        JSISystem.MessageBox("Goodbye!");    
        JSISystem.Exit();                                
    }    
  </script>  
  
</app>

 

Home | Scripting | Products | Purchase | Download | Support | Company

Copyright ©2001, Nombas, Inc. All Rights Reserved.
Questions? Visit
http://support.nombas.com/