" var eStyle=document.getElementsByTagName("style")[0]; strDoc=replaceAllSubstrings(strDoc,"$style$",eStyle.innerHTML); var docprint=window.open("","","toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=650, height=600, left=100, top=25"); docprint.document.open(); docprint.document.write(strDoc); var arTagNames=new Array("div","form"); for (var i=0;i0) { arTag[0].parentNode.removeChild(arTag[0]); }; docprint.document.close(); docprint.focus(); } function printReport(strWidgetID) { var e=document.getElementById("Report_Content"+strWidgetID); if (!e) { alert("No content defined for printing"); return; }; var strContent=e.innerHTML; var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=650, height=600, left=100, top=25"; var strUrl="https://__server__/?Network=GreenLight&ID=getCachedWidget&DocumentID=77NaWu0FhKDKXL7C70JpnKmy&Widget=Printer Wrapper"; var strDoc=getxmlHttpRequest(strUrl); strDoc +=strContent; strDoc +="" var docprint=window.open("","",disp_setting); docprint.document.open(); //docprint.document.write('Aspect Software'); //docprint.document.write('
'); //docprint.document.write(strContent); //docprint.document.write('
'); docprint.document.write(strDoc); docprint.document.close(); docprint.focus(); } //Initializes fields selected when the report is first loaded function initializeReport() { //The widget ID is not available at this point, so check every form in the document for field named "starting_fields_initialized" with a value of false //This value is set when the widget is initially loaded by a script in the widget. The widget also sets the fields "starting_fields_list" and "starting_fields_WidgetID" //This procedure is only necessary so that the display options can be initialized when the widget is first loaded. for (var cntrForm=0;cntrForm1) { if (arStr[0].equalsIgnoreCase("FieldsSelected")) { var options=f.elements["FieldsSelected"].options; options.length=""; arFields=getSubStringArray(arStr[1],","); for (var j=0;j1) { options[options.length]=new Option(arPair[1],arPair[0],false,false); }; }; } else { var strName=arStr[0].substring(6); //field_ is prepended to all form field names var strValue=arStr[1]; for (var j=2;j2) { var f=document.forms["Filter"+strWidgetID]; arString[2]=tokenizeSpecialChars(arString[2],false); //add the display to the drop down list and select it f.Display.options[f.Display.options.length]=new Option(arString[2],arString[1],false,false); f.Display.value=arString[1]; //set the name of the display in the customize div document.getElementById("display_name_"+strWidgetID).innerHTML=arString[2]; }; //hide status message showDisplayOptionsStatus(strWidgetID,strWidgetName,"",false); } else { showDisplayOptionsStatus(strWidgetID,strWidgetName,strResult,true,true); }; }; }; //Deletes a display. The boolConfirm argument is set to true the first time this function is called which causes the confirmation //dialog to be displayed. When this function is called from the confirmation dialog, the widget is deleted function deleteDisplay(strWidgetID,boolConfirm) { if (boolConfirm) { divFilter=document.getElementById("Filter"+strWidgetID); divDelete=document.getElementById("Delete_Display"+strWidgetID); divDelete.style.left=(divFilter.offsetLeft+30)+"px"; var intTopAdjust=getContainerAdjustment(document.getElementById("Customize"+strWidgetID)); divDelete.style.top=(divFilter.offsetTop+divFilter.offsetHeight+30-intTopAdjust)+"px"; divDelete.style.zIndex=4; document.getElementById("Confirm_Delete_Message"+strWidgetID).innerHTML=document.getElementById("display_name_"+strWidgetID).innerHTML; setVisible("Delete_Display"+strWidgetID,true); var arXY=getPosition(divFilter); divDelete.style.top=(arXY[1]+60-intTopAdjust)+"px"; } else { setVisible("Delete_Display"+strWidgetID,false); //show status message var strDisplayName=document.getElementById("display_name_"+strWidgetID).innerHTML; showDisplayOptionsStatus(strWidgetID,strDisplayName,"Deleting display: "+strDisplayName,true,false); var str=convertFormToWidgetContent(strWidgetID); var strDisplayWidgetID=document.forms["Filter"+strWidgetID].Display.value; var strUrl="https://__server__/?Network=Library&ID=acceptWidgetByID&WidgetID="+strDisplayWidgetID+"&delete=true"; //need to use xmlhttprequest when the page is served by a remote server. The problem with this though is that the local widget cache //is not updated when the display is saved because acceptWidgetByID is not called locally var strDisplayServer=document.forms["Filter"+strWidgetID].display_server.value; if (strDisplayServer.indexOf("127.0.0.1")<=0) { //strUrl="https://__server__/?Network=greenlight&ID=getXmlHttpRequest&url=https://"+strDisplayServer+"/?Network=Library|ID=acceptWidgetByID|WidgetID="+strDisplayWidgetID+"|delete=true"; strUrl="https://"+strDisplayServer+"/?Network=Library&ID=acceptWidgetByID&WidgetID="+strDisplayWidgetID+"&delete=true"; }; strResult=getxmlHttpRequest(strUrl); //alert("delete display Result="+strResult); if (strResult.startsWith("ok")) { //remove the display from the drop-down list and select the next one up var f=document.forms["Filter"+strWidgetID]; var intNewSelection=-1; for (var i=0;i=Select.options.length) return; if ((Index+Direction>Select.options.length-1) || (Index+Direction<0)) return; var strText=Select.options[Index].text; var strValue=Select.options[Index].value; var boolSelected=Select.options[Index].selected; Select.options[Index].text=Select.options[Index+Direction].text; Select.options[Index].value=Select.options[Index+Direction].value; Select.options[Index].selected=Select.options[Index+Direction].selected; Select.options[Index+Direction].text=strText; Select.options[Index+Direction].value=strValue; Select.options[Index+Direction].selected=boolSelected; }; //moves selected fields up function moveFieldsUp(strWidgetID) { var Select2=document.forms["Filter"+strWidgetID].FieldsSelected; for (var i=0;i=0;i--) { if (Select2.options[i].selected) moveField(Select2,i,1); }; //set tooltips for all fields selected setTooltipsForFieldsSelected(strWidgetID); }; //Displays the dialog used to customize a display function editFilter(strWidgetID,e) { //initialize fields available from the master list (less those in the selected list) updateFieldsAvailable(strWidgetID); divFilter=document.getElementById("Filter"+strWidgetID); //The div containing the display drop-down and save/delete/refresh buttons divCustom=document.getElementById("Customize"+strWidgetID); //The div containing the display settings. This is the div that will be made visible. divCustomFields=document.getElementById("FilterCustomFields"+strWidgetID); //The div containing fields specific to the selected table. It is contained in the custom div var intTop=divFilter.offsetTop+divFilter.offsetHeight; //adjust the top coordinate if the widget is being displayed inside an absolutely positioned div in a widget container. //The absolute positioning of the div causes the filter dialog to be positioned relative to the container div var intTopAdjust=getContainerAdjustment(document.getElementById("Customize"+strWidgetID)); divCustom.style.left=divFilter.offsetLeft+"px"; //divCustom.style.width=divFilter.offsetLeft+divFilter.offsetWidth+"px"; divCustom.style.top=intTop-intTopAdjust; divCustom.style.zIndex=3; setVisible("Customize"+strWidgetID,true); divCustom.style.height=(400+divCustomFields.offsetHeight)+"px"; if (e) { var d=document.getElementById("Customize"+strWidgetID); var arXY=getPosition(e); d.style.top=(arXY[1]+30-intTopAdjust)+"px"; //(arXY[1]>=20) ? d.style.top=(arXY[1]-20)+"px" : d.style.top="0px"; //d.style.left=0; }; //divCustom.style.width=divContainer.offsetWidth; }; //Closes the dialog used to customize a display function closeEditFilter(strWidgetID) { setVisible("Customize"+strWidgetID,false) }; /****************************************************************************************************** MISCELLANEOUS UTILITIES ******************************************************************************************************/ /* Gets the xy position of an element relative to the body of the document */ function getPosition(e){ var topValue=0,leftValue=0; while(e){ leftValue+=e.offsetLeft; topValue+=e.offsetTop; e=e.offsetParent; } var arXY=new Array(leftValue,topValue); return arXY; }; /* Gets the description associated with the selected option in a select input */ function getOptionDescription(strFormName,strElementName) { var e=document.forms[strFormName]; if (e) { e=document.forms[strFormName].elements[strElementName]; if (e) { for (var i=0;iClose this window"; str +=""; str +=""; str +=""; div.innerHTML=str; setVisible("video_display",true); }; // This function does not work in IE. Errors are thrown in the appendChild functions function playVideo1(strVideoID) { //create the embed object var obj=document.createElement('object'); obj.setAttribute("ID","embedded_video"); //set the parameters var param=document.createElement('param'); param.setAttribute("allowFullScreen","true"); param.setAttribute("allowscriptaccess","always"); param.setAttribute("name","movie"); obj.appendChild(param); var param=document.createElement('embed'); param.setAttribute("src","http://www.youtube.com/v/"+strVideoID+"?fs=1&hl=en_US"); param.setAttribute("type","application/x-shockwave-flash"); param.setAttribute("allowscriptaccess","always"); param.setAttribute("allowfullscreen","true"); param.setAttribute("width","1024"); param.setAttribute("height","576"); obj.appendChild(param); //get the div that will display the video var div=document.getElementById("video_display"); //add a div if one has not been included on the page if (!div) { div=document.createElement('div'); div.setAttribute("class","play_video"); div.setAttribute("id","video_display"); var divClose=document.createElement('div'); divClose.setAttribute("class","close_video"); var a=document.createElement('a'); a.setAttribute("href","javascript:setVisible('video_display',false)"); a.onclick=Function("setVisible('video_display',false)"); a.innerHTML="Close this window"; divClose.appendChild(a); div.appendChild(divClose); document.body.appendChild(div); }; //remove any existing video from the div var v=document.getElementById("embedded_video"); if (v) div.removeChild(v); //add the new video div.appendChild(obj); setVisible("video_display",true); }; /****************************************************************************************************** ComboBox ******************************************************************************************************/ function comboBox(aFormName,aInputName,aSelectName) { //alert("initializing comboBox("+aFormName+","+aInputName+","+aSelectName+")"); appendToLog("initialize combobox("+aFormName+","+aInputName+","+aSelectName+")"); //Array of options originally added to the select box this.arOptionName=new Array(); this.arOptionValue=new Array(); //Create an ID for the combobox and add it to the array of comboboxes if (!window.arComboBox) window.arComboBox=[]; this.ID=window.arComboBox.length; window.arComboBox[this.ID]=this; this.comboBoxShow=f_comboBoxShow; this.comboBoxHide=f_comboBoxHide; this.comboBoxHideIfNotSelectFocused=f_comboBoxHideIfNotSelectFocused; this.comboBoxToggle=f_comboBoxToggle; this.comboBoxUpdateList=f_comboBoxUpdateList; this.comboBoxSetValue=f_comboBoxSetValue; this.comboBoxSelectHasFocus=f_comboBoxSelectHasFocus; eForm=document.forms[aFormName]; if (eForm) { this.eInput=eForm.elements[aInputName]; this.eSelect=eForm.elements[aSelectName]; if (!this.eInput) alert("Error initializing comboBox. Input does not exist: "+aInputName); if (!this.eSelect) alert("Error initializing comboBox. Select does not exist: "+aSelectName); if ((!this.eInput) || (!this.eSelect)) return; this.SelectHasFocus=false; //add functions to the input and select controls this.eInput.onclick=Function("arComboBox['" + this.ID + "'].comboBoxShow()"); this.eInput.onkeyup=Function("arComboBox['" + this.ID + "'].comboBoxUpdateList()"); this.eInput.onblur=Function("arComboBox['" + this.ID + "'].comboBoxHideIfNotSelectFocused()"); this.eSelect.onclick=Function("arComboBox['"+ this.ID + "'].comboBoxHide()"); this.eSelect.onfocus=Function("arComboBox['"+ this.ID + "'].comboBoxSelectHasFocus()"); this.eSelect.onblur=Function("arComboBox['"+ this.ID + "'].comboBoxHide()"); //save a copy of the options defined in the select input for (var i=0;i0) this.eSelect.remove(0); //get the text displayed in the input box var str=this.eInput.value.toUpperCase(); //add options that contain the text for (var i=0;i=0)) { var eOption=document.createElement("option"); eOption.text=this.arOptionName[i]; eOption.value=this.arOptionValue[i]; try { this.eSelect.add(eOption,null); // standards compliant; doesn't work in IE } catch(ex) { this.eSelect.add(eOption); // IE only }; }; }; }; function f_comboBoxHideIfNotSelectFocused() { if (!(this.SelectHasFocus)) this.comboBoxHide(); }; function f_comboBoxSelectHasFocus() { this.SelectHasFocus=true; }; function f_comboBoxShow() { if (this.eSelect) { //position and size the select box this.eSelect.style.left=this.eInput.offsetLeft; this.eSelect.style.top=this.eInput.offsetTop+this.eInput.offsetHeight; this.eSelect.style.zIndex=10000; this.eSelect.style.width=this.eInput.offsetWidth; this.eSelect.style.display="block"; }; }; function f_comboBoxHide() { if (this.eSelect) { this.comboBoxSetValue(); this.eSelect.style.display="none"; this.SelectHasFocus=false; }; }; function f_comboBoxToggle() { //alert("toggle combobox"); if (this.eSelect) { if (this.eSelect.style.display=="none") { this.comboBoxShow(); } else { this.comboBoxHide(); }; }; };

Aspect Exports Tech Doc

Accounting & Report Exports

Tasks are recorded in the Aspect6_Export_Task driver using the structure with the same name. The structure includes scheduled task fields so each record in the driver is a scheduled task that can be enabled or disabled. Any special information required to execute the task (e.g. payroll service, accounting package, etc.) is recorded in the task.

The Export_Type field determines the type of export to be done. These are defined in the Aspect6_Export_Task_Types collection as:

  • 0,-- Select --
  • 1,Accounting - Sales
  • 2,Accounting - Payroll
  • 3,Accounting - Invoices
  • 4,Check Details
  • 5,Check Headers
  • 6,Cost Of Sales
  • 7,Employee Records
  • 8,Employee Schedule
  • 9,Income & Expense
  • 10,Inventory Extensions
  • 11,Labor Detail
  • 12,Menu Items
  • 13,Menu Profit Report
  • 14,POS ID's
  • 15,Sales Mix Detail
  • 16,Sales Record
  • 17,Sales Summary

  • The target for each task is Aspect6_executeExportTask, a script in the Aspect6 Core package. This script adds each task to a queue and then takes charge of processing tasks in the queue unless another instance of the script has already taken charge. The queue is used to allow many exports to be fired at once and still execute them sequentially without slowing down the program.

    When a task is processed, the widget named "Aspect6 Export Task" is loaded with the Task ID passed as a parameter. The widget is a script that executes the task. It determines the start/end dates to be exported and prepares command-line arguments that are passed to Aspect6 to do the export. It calls Aspect6 once for each store selected and creates a temporary file that is copied to the filename specified in the task.

    Mirror Export

    A dynamic library client defined in Aspect Linked with the ID Aspect_Generic_Export is used to monitor files in the selected store directories. When the preferences are submitted, the library client is enabled or disabled and the filespec is calculated based on the preferences. The filespec is recorded in the Aspect_Linked_Pref_Exports_Generic_Filespec field of Aspect Linked preferences because it may be too long to fit directly in the library client. The library client's filespec is set to the token defined by this field (Aspect_Linked_Pref_Exports_Generic_Filespec).

    The template for the library client is set to "Post to file" with no filename specified. This causes the post to abort, but not before calling the viewer used to export the file. The view is a widget named "Viewer for generic export" in the Aspect Exports widget library. The viewer merges the source file to an output file. It determines the appropriate driver ID's based on the filename, sets up the arguments for the merge and then calls the merge. The viewer will abort if the file is of type mm-dd-yy.xxx (e.g. 01-01-10.lbr) and the file contains data prior to the date specified in the preferences. The viewer will also abort if the destination file already exists and it's date/time stamp is later than that of the source file.

    Structures used in the export are defined in Aspect Linked and begin with Aspect_Linked_GenPos_. Each structure has three drivers associated with it - one for an ascii output comma-delimited, one for ascii tab-delimited and one for dbase.