<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>

<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/System.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DataSet.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/Control.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DBControl.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DBNavigator.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DBPageNavigator.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DBGrid.js"></SCRIPT>
<SCRIPT language=JavaScript type="text/javascript" SRC="jcl/DateTimeInput.js"></SCRIPT>

</head>
<BODY onload='afterload();'>
</BODY>
</html>

<SCRIPT language=JavaScript type="text/javascript">

function afterload(){
    init();
}

function init(){
    window.DataSet1=new DataSet();
    var Field2 = new Field("SALE_ID","INTEGER");
    var Field3 = new Field("SALE_CLIENT_ID","VARCHAR");
    var Field4 = new Field("SALE_SELLER_ID","VARCHAR");
    var Field5 = new Field("SALE_DATE","DATETIME");
    var Field6 = new Field("SALE_TYPE","VARCHAR");
    var Field7 = new Field("SALE_NOTE","VARCHAR");
    var Field1 = new Field("DataSet2","NESTED");
    window.DataSet2=new DataSet(DataSet1);
    var Field8 = new Field("ITEM_ID","INTEGER");
    var Field9 = new Field("ITEM_PRODUCT_ID","VARCHAR");
    var Field10 = new Field("ITEM_PRICE","REAL");
    var Field11 = new Field("ITEM_AMOUNT","INTEGER");
    window.Div1=new Div();
    window.Span1=new Span(Div1);
    window.Span10=new Span(Div1);
    window.DBNavigator2=new DBNavigator(Div1);
    window.DBNavigator1=new DBNavigator(Div1);
    window.DBGrid1=new DBGrid(Div1);
    var Column1 = new Column();
    var Column2 = new Column();
    var Column3 = new Column();
    var Column4 = new Column();
    var Column5 = new Column();
    var Column6 = new Column();
    window.DBGrid2=new DBGrid(Div1);
    window.DBPageNavigator2=new DBPageNavigator(Div1);
    window.Span2=new Span(Div1);
    window.Edit1=new Edit(Div1);
    window.Button1=new Button(Div1);
    DataSet1.Name='DataSet1';
    DataSet1.Fields.Add(Field2);
    DataSet1.Fields.Add(Field3);
    DataSet1.Fields.Add(Field4);
    DataSet1.Fields.Add(Field5);
    DataSet1.Fields.Add(Field6);
    DataSet1.Fields.Add(Field7);
    DataSet1.Fields.Add(Field1);
    DataSet1.Fields.Auto = false;
    DataSet1.MaxRows=5;
    DataSet1.DataSource='demo.MasterDetail_ResultSet';
    Field2.Name='Field2';
    Field2.Type='INTEGER';
    Field2.FieldName='SALE_ID';
    Field3.Name='Field3';
    Field3.Type='VARCHAR';
    Field3.FieldName='SALE_CLIENT_ID';
    Field4.Name='Field4';
    Field4.Type='VARCHAR';
    Field4.FieldName='SALE_SELLER_ID';
    Field5.Name='Field5';
    Field5.Type='DATETIME';
    Field5.FieldName='SALE_DATE';
    Field6.Name='Field6';
    Field6.Type='VARCHAR';
    Field6.FieldName='SALE_TYPE';
    Field7.Name='Field7';
    Field7.Type='VARCHAR';
    Field7.FieldName='SALE_NOTE';
    Field1.Name='Field1';
    Field1.Type='NESTED';
    Field1.FieldName='DataSet2';
    DataSet2.Name='DataSet2';
    DataSet2.Fields.Add(Field8);
    DataSet2.Fields.Add(Field9);
    DataSet2.Fields.Add(Field10);
    DataSet2.Fields.Add(Field11);
    DataSet2.Fields.Auto = false;
    DataSet2.MaxRows=-1;
    DataSet2.MasterLink=DataSet1;
    DataSet2.MasterFields='SALE_ID';
    DataSet2.DetailFields='ITEM_ID';
    Field8.Name='Field8';
    Field8.Type='INTEGER';
    Field8.FieldName='ITEM_ID';
    Field9.Name='Field9';
    Field9.Type='VARCHAR';
    Field9.FieldName='ITEM_PRODUCT_ID';
    Field10.Name='Field10';
    Field10.Type='REAL';
    Field10.FieldName='ITEM_PRICE';
    Field11.Name='Field11';
    Field11.Type='INTEGER';
    Field11.FieldName='ITEM_AMOUNT';
    Div1.Name='Div1';
    Div1.style.height='666';
    Div1.style.width='679';
    Div1.style.position='absolute';
    Div1.style.left='11';
    Div1.style.top='17';
    Span1.Name='Span1';
    Span1.innerText='Master and details by use resultset';
    Span1.style.height='24';
    Span1.style.width='324';
    Span1.style.position='absolute';
    Span1.style.left='198';
    Span1.style.top='5';
    Span1.style.fontSize='18';
    Span10.Name='Span10';
    Span10.innerText='Detail Data:';
    Span10.style.height='21';
    Span10.style.width='129';
    Span10.style.position='absolute';
    Span10.style.left='8';
    Span10.style.top='313';
    DBNavigator2.Name='DBNavigator2';
    DBNavigator2.style.height='27';
    DBNavigator2.style.width='653';
    DBNavigator2.style.position='absolute';
    DBNavigator2.style.left='9';
    DBNavigator2.style.top='334';
    DBNavigator2.DataSet=DataSet2;
    DBNavigator1.Name='DBNavigator1';
    DBNavigator1.style.height='29';
    DBNavigator1.style.width='653';
    DBNavigator1.style.position='absolute';
    DBNavigator1.style.left='10';
    DBNavigator1.style.top='79';
    DBNavigator1.DataSet=DataSet1;
    DBGrid1.Name='DBGrid1';
    DBGrid1.style.height='153';
    DBGrid1.style.width='651';
    DBGrid1.style.position='absolute';
    DBGrid1.style.left='10';
    DBGrid1.style.top='118';
    DBGrid1.Columns.Add(Column1);
    DBGrid1.Columns.Add(Column2);
    DBGrid1.Columns.Add(Column3);
    DBGrid1.Columns.Add(Column4);
    DBGrid1.Columns.Add(Column5);
    DBGrid1.Columns.Add(Column6);
    DBGrid1.Columns.Auto = false;
    DBGrid1.DataSet=DataSet1;
    Column1.Name='Column1';
    Column1.DataField='SALE_ID';
    Column1.Caption='SALE_ID';
    Column2.Name='Column2';
    Column2.DataField='SALE_CLIENT_ID';
    Column2.Caption='SALE_CLIENT_ID';
    Column3.Name='Column3';
    Column3.DataField='SALE_SELLER_ID';
    Column3.Caption='SALE_SELLER_ID';
    Column4.Name='Column4';
    Column4.DataField='SALE_DATE';
    Column4.Caption='SALE_DATE';
    Column5.Name='Column5';
    Column5.DataField='SALE_TYPE';
    Column5.Caption='SALE_TYPE';
    Column6.Name='Column6';
    Column6.DataField='SALE_NOTE';
    Column6.Caption='SALE_NOTE';
    DBGrid2.Name='DBGrid2';
    DBGrid2.style.height='134';
    DBGrid2.style.width='652';
    DBGrid2.style.position='absolute';
    DBGrid2.style.left='9';
    DBGrid2.style.top='371';
    DBGrid2.DataSet=DataSet2;
    DBPageNavigator2.Name='DBPageNavigator2';
    DBPageNavigator2.style.height='28';
    DBPageNavigator2.style.width='580';
    DBPageNavigator2.style.position='absolute';
    DBPageNavigator2.style.left='9';
    DBPageNavigator2.style.top='277';
    DBPageNavigator2.DataSet=DataSet1;
    Span2.Name='Span2';
    Span2.innerText='No.';
    Span2.style.height='21';
    Span2.style.width='36';
    Span2.style.position='absolute';
    Span2.style.left='9';
    Span2.style.top='49';
    Edit1.Name='Edit1';
    Edit1.style.height='21';
    Edit1.style.width='130';
    Edit1.style.position='absolute';
    Edit1.style.left='40';
    Edit1.style.top='47';
    Button1.Name='Button1';
    Button1.value='Search';
    Button1.style.height='21';
    Button1.style.width='75';
    Button1.style.position='absolute';
    Button1.style.left='177';
    Button1.style.top='46';
    Button1.onclick=Button1onclick;
    DataSet1.Open();
}
//search by SALE_ID
function Button1onclick() {
    DataSet1.Close();
    DataSet1.Params.Clear();
    if(Edit1.value) {
        DataSet1.Params.Add(new Param('SALE_ID',Edit1.value,'int'));
    }
    DataSet1.Open();
}
</SCRIPT>
