Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2005, 12:23 PM
Authorized User
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Function for Each Report Listed

I have created a Combo Box which includes the following options.
Domestic forms which will include the Pack List and Commercial Invoice. International Forms which will include the Pack List, Commercial Invoice, Shipper Export Declaration, SLI, and Certificate of Origin. After the choice I have given the user the choice to choose any of the forms individually. I am not sure how to get this to work. I am enclosing my code. I am still learning ASP Pages.
<%@ Language=VBScript %>
<%Option Explicit%>


<%
Dim mstrMessage, mstrPageTitle, mstrPageSubTitle, mstrAppUdl
Dim mblnMANUAL, mblnValidRequest
Dim i_printer
Dim i_sales_order
Dim i_packing_slip





mStrAppUdl = gStrFastpic_Nam_Prod
mstrPageTitle = "Packeteer Baan Reports"
mstrPageSubTitle = " "
'--------------------------------------------------------------

Sub Initialize()
 'on error resume next

  mStrAppUdl = gStrFastpic_Nam_Prod
  mstrPageTitle = "Packeteer Baan Reports"
  mstrPageSubTitle = " "

End Sub
'--------------------------------------------------------------

Sub Build_cboreport '(blnInTable)
'------------------------------------------------------------------------------
' if blnInTable = True then add html row <tr> and column <td>
'------------------------------------------------------------------------------

    Const strCONTROL = "cboReport"

    'If blnInTable then Response.Write "<tr><td>" & vbCrLf
    'Response.Write "Select Report:" & vbCrLf
    'If blnInTable then Response.Write "</td><td>" & vbCrLf

    Response.Write "<td>"
    Response.Write "<STRONG>Select Report:</STRONG>" & vbCrLf

    Response.Write "<select name=" & strCONTROL & ">" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "Domestic") & ">Domestic Forms" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "International") & ">International Forms" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "PackList") & ">Pack List" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "cominvoice") & ">Commercial Invoice" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "shipperexport") & ">Shipper Export Declaration" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "SLI") & ">SLI" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "Certificate") & ">Certificate of Origin" & vbCrLf
    Response.Write "</select>" & vbCrLf
    Response.Write "</td>"

    'If blnInTable then Response.Write "</td></tr>" & vbCrLf
End Sub

Sub Build_cboprinter'(blnInTable)
'------------------------------------------------------------------------------
' if blnInTable = True then add html row <tr> and column <td>
'------------------------------------------------------------------------------

    Const strCONTROL = "cboprinter"

    'If blnInTable then Response.Write "<tr><td>" & vbCrLf
    'Response.Write "Select Report:" & vbCrLf
    'If blnInTable then Response.Write "</td><td>" & vbCrLf

    Response.Write "<td>"
    Response.Write "<STRONG>Select Printer:</STRONG>" & vbCrLf

    Response.Write "<select name=" & strCONTROL & ">" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "10") & ">cmlaser10" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "13") & ">cmlaser13" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "23") & ">cmlaser23" & vbCrLf
    Response.Write "<option" & PreserveSelect(strCONTROL, "26") & ">cmlaser26" & vbCrLf
    Response.Write "</select>" & vbCrLf
    Response.Write "</td>"

    'If blnInTable then Response.Write "</td></tr>" & vbCrLf
End Sub


Function PreserveSelect(strControl, strValue)
'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------
    PreserveSelect = " value=" & strValue
    If Request.QueryString(strControl) = strValue or Request.Form(strControl) = strValue then
        PreserveSelect = PreserveSelect & " selected"
    End If
End Function

Sub Main()
    'GetFormDebugInfo

    on error resume next

    'Response.Write(Request.Form("cboReport") & "<br>")
    if Request.Form.Count = 0 then exit sub
    if Request.Form("cboReport") = "select" then
        Response.Write("Please Select Report <br>")
        exit sub
    end if
    if Request.Form("cboprinter") = "select" then
        Response.Write("Please Select Printer <br>")
        exit sub
        end if
        WriteData

    if trim(Request.Form("txtSalesOrder")) = "" _
    and trim(Request.Form("txtPackingSlip")) = "" then

            Response.Write "Please Enter Sales Order."
        else
            'Response.Write "Sales Order Logic Is Under Construction."
            'Response.Write "<br>Please Enter Sales Order."
            GetSalesData
        end if



    with Response
        .Write "</P>"
        .Write "</center>"
        .Write "</form>"
    end with

    Response.Write err.description
    err.clear
End Sub
'--------------------------------------------------------------
Sub GetsalesData()
'************************************************* *************
on error resume next

    if Request.Form("txtSalesOrder") <> "" _
       or Request.Form("txtPackingSlip") <> "" then
      ' Sales Information ***
        GetAnyData_DataAccessWrapper mStrAppUdl _
            , "stored_procedure" _
            , "baan_dev.test_file_output.print_packing_slip" _
            , array("NAM", Request.Form("txtSalesOrder"), Request.Form("txtpackingslip"), "ACTIVE","1") _
            , "html_table" _
            , "t1"
            Response.Write "<br>"
    end if

    Response.Write err.description
    err.clear

set gObjCreateData = Nothing
end sub


Sub WriteData()
  Dim intAttritionPosition
  Dim strReasonCode, strRequestNumber

  Set Request.Form("txtPackingSlip")=Request.Form("i_pac king_slip")
  Set Request.Form("cboprinter") = Request.Form("i_printer")
  Set Request.Form("txtSalesOrder") = Request.Form("i_sales_order")

    'on error resume next
    GetAnyData_DataAccessWrapper mStrAppUdl _
     , "stored_procedure" _
     , "baan_dev.test_file_output.print_packing_slip" _
     , array("NAM",Request.Form("cboreport"),Request.Form ("i_printer"), Request.Form("i_sales_order"),Request.Form("i_pack ing_slip")) _
     , "html_table" _
     , "t1"
'

    Response.Write err.description
    err.clear
end sub
'--------------------------------------------------------------
function PreserveSalesOrderValue()
  if trim(Request.Form("txtsalesorder")) <> "" then
      PreserveSalesOrderValue = ucase(Request.Form("txtsalesorder"))
    else
        PreserveSalesOrderValue = ""
    end if
end function

function PreservePackingslipValue()
  if trim(Request.Form("txtPackingSlip")) <> "" then
      PreservePackingSlipValue = ucase(Request.Form("txtPackingSlip"))
    else
          PreservePackingSlipValue = ""
    end if
end function



%>
<script language=javascript>
    function salesorder_clear_family()
        {
          //alert('!');
          frmMain.txtSaleOrder.value = '';
          frmMain.txtPackingSlip.value = '';
        }

    function packslip_clear_family()
        {
          frmMain.txtSalesOrder.value = '';
          frmMain.txtPackingSlip.value = '';
        }

    function order_clear_slip()
        {
          frmMain.txtpackingslip.value = '';

        }

    function disable_order()
        {
            if (frmMain.txtSalesOrder.value > '')
            {
              frmMain.txtpackingslip.disabled = true;
                         }
        }
</SCRIPT>



<html><BODY bgColor=LemonChiffon>


<%
    GetHeader mstrPageTitle, mstrPageSubTitle
%>
<form Name=frmMain action="" method=post>

<table width=300 align=center class=cls_1>

 <tr> <%Build_cboReport %>
  <tr> <%Build_cboprinter %>
  <tr><td colspan=2><i><STRONG>Please Provide Criteria:</STRONG></i></td></tr>

    <tr><td><STRONG>Sales Order:</STRONG></td><td>
    <INPUT onchange=order_clear_slip type=text size=26 maxlength=20 name=txtsalesorder value=<%=PreservesalesorderValue%>>
    </td></tr>
    <tr><td><STRONG>Packing Slip:</STRONG></td><td>
    <INPUT onchange=packslip_clear_family type=text size=26 maxlength=20 name=txtpackingslip value=<%=PreservepackingslipValue%>>
    </td></tr>

</table>

<center>
<br>
<input type=submit title="Submit request" name=cmdSubmit value="Submit Request">
<P>
<%
    Main()

%>

 
Old February 11th, 2005, 07:44 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please add what is working on this page and where do you stock? So we can fix just that.
 
Old February 11th, 2005, 08:32 PM
Authorized User
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by YURIY
 Please add what is working on this page and where do you stock? So we can fix just that.
My question is how to call each of the different forms. For example I need the domestic forms to call the Pack List.

The International Forms to call all five of the forms. I am not sure how to write the subroutines for each of the five potential forms.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Sites not listed after creation stokerfed SharePoint Admin 1 June 5th, 2007 02:29 PM
Aggregate function MAX creating problem..? Manu SQL Language 4 May 30th, 2006 04:41 AM
India TimeZone not listed deepak.vasudevan Forum and Wrox.com Feedback 0 September 2nd, 2005 02:34 AM
Un-listed Source code mikea All Other Wrox Books 1 August 29th, 2005 09:16 AM
Creating a function to add a new worksheet edcaru Excel VBA 2 August 16th, 2004 01:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.