|
Legend with a few mods it worked like a charm...... thanks for all your help!!
Take care,
Michael
|
|
|
|
|
Here it goes....
I have some receipt logs that are written by my POS software. At the same time the log is written there is an entry made in my database (Access) with the path and receipt ID for the entry. The entry in the database for example looks like this; each item is a column in the database.
Trans Number: D2073
Log File: Logs\DRLog032005I.log
Receipt: D38592207362963
The receipt log file that corresponds to this is located in the Logs directory and is file name DRLog032005I.log
Ok now the fun stuff
Here is a clipping from one of my receipt logs this is actually two receipts one of them corresponds to the above mentioned receipt the other is the sequential log entry. As you can see there is a lead in and lead out for each receipt.
What I am trying to do is display a single receipt from the log on a page for the purpose of printing. I already have the database connection established and I know how to get the information from the database to the fields that I need to. What I do not know is how to call in the information from the log files. The information on reading text files using ASP "readfile.asp" is pretty good but I am not sure how to modify it so that it just displays the single receipt information. Any help will be greatly appreciated
Ex. lead in "<receipt>D38592207362963"
Ex. lead out "D38592207362963"
<++++++++++++++++++++++++++++++++++++++>
<receipt>D38592207362963
RETURNS, EXCHANGES, AND CREDITS
WARRANTED WITHIN 10 DAYS OF SALE,
AND ONLY IF RECEIPT IS PRESENTED!
THANK YOU!
Transaction#: D2073
CLERK: CORY
Date: 08/28/2005 Time: 08:18:45 AM
Due Date: 09/10/2005
*** SALE ***
Bill To:
Customer # ****
CORY *****
P O BOX ***
GRAY, LA *****
***-***-****
____________________________________
5109WB 6V UTILITY LANTERN
6373518
2.00 EA @ $5.99 T $11.98
074196003077
11863 6 GAL WATER CAN
6559165
2.00 EA @ $10.15 T $20.30
Subtotal: $32.28
4% Louisiana State Tax: $1.29
4.5% Terrebonne Parish Tax: $1.45
TOTAL: $35.02
INVOICE: $35.02
CHANGE: $0.00
(X)__________________________________
Authorized Signature
A Finance Charge of 1.5% per month
applies to all past due invoices
.-----------------------------------.
HOURS = 7-6 M-F, 8-5 SAT, 8-3 SUN
***-***-****
*************** HOUMA, LA *****
D38592207362963
<++++++++++++++++++++++++++++++++++++++>
<receipt>D38592208775926
RETURNS, EXCHANGES, AND CREDITS
WARRANTED WITHIN 10 DAYS OF SALE,
AND ONLY IF RECEIPT IS PRESENTED!
THANK YOU!
Transaction#: D2087
CLERK: CODY
Date: 08/28/2005 Time: 10:55:58 AM
Due Date: 09/10/2005
*** SALE ***
Bill To:
Customer # ****
AMERICAN MACHINE & MFG., LLC
P O BOX ****
HOUMA, LA *****
***-***-****
____________________________________
5109WB 6V UTILITY LANTERN
6373518
3.00 EA @ $5.99 T $17.97
074196003077
ONE PRO CELL C BATTERY
PCCB
24.00 EA @ $1.014 T $24.34
Subtotal: $42.31
4% Louisiana State Tax: $1.69
4.5% Terrebonne Parish Tax: $1.90
TOTAL: $45.90
INVOICE: $45.90
CHANGE: $0.00
(X)__________________________________
Authorized Signature
A Finance Charge of 1.5% per month
applies to all past due invoices
.-----------------------------------.
HOURS = 7-6 M-F, 8-5 SAT, 8-3 SUN
***-***-****
***************** HOUMA, LA *****
D38592208775926
|
|
|
|
|
Use a TextReader, or other object, to read each line from the beginning ID to the end ID.
something like this
do<br />
{ <br />
string line = reader.ReadLine() <br />
) while( line != "D38592207362963" )
IMO a better solution would be to forgo the files and Access database. Use SQL Server, SQL Express is free, or SQL Server Compact if you need a smaller footprint. You will get better performance, it will be extensible and structuring the data will allow for more effecient searching and reporting.
only two letters away from being an asset
|
|
|
|
|
Dim TextStream
Set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
Do Until TextStream.readline = "D38592207362963"
Dim LineA
LineA = TextStream.readline
LineA = LineA & vbCRLF
Response.write LineA
Loop
I am trying this but it only displays every other line?????
-- modified at 9:15 Wednesday 6th June, 2007
|
|
|
|
|
This seems to work for me.
using(StreamReader sr = new StreamReader("receipt.txt"))<br />
{<br />
sr.ReadLine();<br />
sr.ReadLine();<br />
<br />
string Line;<br />
do<br />
{<br />
} while( (Line = sr.ReadLine()) != null && Line.Trim().Contains("D38592207362963") == false );<br />
}
I don't do VB so you are on your own to translate it.
I would still advise to rearchitect the application away from files and Access
only two letters away from being an asset
|
|
|
|
|
I would love to restructure but the database I am accessing is put together by my software vendor for the POS and accounts receivable software. I am not sure why they do not go to SQL but for now it is what I have to work with. Thanks for the help thus far.
Please look at my new post about TextStream
|
|
|
|
|
Hi,
I am developing a server control where I have a property named UploadFolder. This Upload folder will be the virtual path starting with "~/" within the Web Application. Now as I did not find any DesignTime Editor for editing Folder Path although I found for URLEditor or IMAGEURL Editor etc, I wanted to develop my own Windows Form oriented Design Time folder path editor. In my Windows Form, I have used FolderBrowser Dialog but I want to set the root directory of that dialog to the Web Application's path. I dont see any method to get the Web Application Path from that Windows Form. Can you please help me about it.
Thanks a loooooot.
|
|
|
|
|
I have 10 textboxes and now I have to validate them using Required Field Validator. Is there any way to validate them without using 10 required field validators(i.e. only using one). Or are there any better ideas.
|
|
|
|
|
|
Hi all,
I have an usercontrol where i gave a radiobutton list.(rblTest)
I am using this usercontrol in my aspx page.
RadioButtonList rblTest= (System.Web.UI.WebControls.RadioButtonList)myControl1.FindControl("rblTest");<br />
I need to handle onselectindexchanged method of radiobutton list in aspx page.
How to do that.
Plz give ur suggestions.
Thanks in advance
cheers
sangeet
|
|
|
|
|
To do that you must first declare in your "hosting" aspx page a procedure which will handle an event:
public void RadioButtonIndexChangedProc(object sender, System.EventArgs e)<br />
{<br />
RadioButtonList rbl = (RadioButtonList) sender;<br />
}
Next in the user control, in the SelectedIndexChange event call that procedure:
private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
WebForm1 page = (WebForm1) Page;<br />
page.RadioButtonIndexChangedProc(sender, e);<br />
}
As you can see, you can access your hosting aspx page by using Page object, and by casting it to appropriate type (class of your hosting page, in my case WebForm1 ) you have access to all public class members.
In case of reusing an usercontrol on diffrent web pages think about implementing one base class or implementing an Interface which will handle RadioButtonIndexChange by every class which uses your usercontrol.
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
OKi,
in addition to my above answer, there is a solution which uses interface.
First, we implement an Interface:
public interface IRadioButtonListEvent<br />
{<br />
void RadioButtonIndexChangedProc(object sender, System.EventArgs e);<br />
}
As you can see, our interface implements just one method, which will be called whenever selected item index changes.
Now, in the User Control, RadioButtonList1_SelectedIndexChanged should look like this:
private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
IRadioButtonListEvent iPage = (IRadioButtonListEvent) Page;<br />
iPage.RadioButtonIndexChangedProc(sender, e);<br />
}<br />
And finally, code for hosting web page. As i mentioned above, page must implement an IRadioButtonListEvent interface.
public class WebForm1 : System.Web.UI.Page, IRadioButtonListEvent<br />
...<br />
<br />
public void RadioButtonIndexChangedProc(object sender, System.EventArgs e)<br />
{<br />
RadioButtonList rbl = (RadioButtonList) sender;<br />
}
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
Both of your solutions couple the user control and page together very strongly, which limits the flexiblity and reuse.
only two letters away from being an asset
|
|
|
|
|
Handle the onselectindexchanged event in your user control and create an event in your user control that any page can subscribe to that reflects the onselectindexchanged event. A technique called event bubbling.
http://www.odetocode.com/Articles/94.aspx[^]
only two letters away from being an asset
|
|
|
|
|
Hi in my form using crystalreportviewer i dispalyed my crystal form..,
And in print button i said this code...,
report.SetDatabaseLogon("sa", "pwd", "server", "Databasename")
report.PrintToPrinter(1, False, 0, 0)
If i click the print button process is going on..,
But in between process will stop its not printing the page...,
Plz any one solve my probs...,
Magi
|
|
|
|
|
how to create master detail for ADD/EDIT/Delete/Display
master data
(company code , name, mapcode)
- text box
detail data
( company detail code, fin_statdate, fin_enddate, process_status, companycode)
--grid view
vijaya
vijaya
|
|
|
|
|
If you are using 2.0 there is a DetailsView control that can be bound to the master's (possibly a grid view control) data source.
only two letters away from being an asset
|
|
|
|
|
Check out that ASP.NET Data Tutorial series on the asp.net site, they'll show you what you want to do.
|
|
|
|
|
i am attempting to write the cookies for a landing page.
i have used the following code to analyse the presence of cookies, but dont know how to write the cookie for the page loading.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Request.Cookies("Landing") Is Nothing Then
'if the name cookie does not exist ask user to enter name
Response.Redirect("landing.aspx")
Else
'if cookies already exist then show landing page
Response.Redirect("tMN_index.aspx")
End If
this seems to work in terms of directing to the landing page.. just need the cookie help....
i basically want the landing page to appear if the cookie isnt present, and then the landing page to generate the cookie if not present.
thank you
John Michael Kinsella
kinsellajohn@hotmail.com
|
|
|
|
|
As I understand, you want to know how to create a new cookie. Below is a simple example how to do that. Depends on your needs, set appropriate properties of System.Web.HttpCookie object.
Basically you simply add a new cookie object into Response.Cookies collection and that's all. Using Respose.Cookies class you can also remove or change any cookie your application creates.
Dim cookie As System.Web.HttpCookie
Dim cookieName As String
Dim cookieValue As String
cookie = New System.Web.HttpCookie(cookieName, cookieValue)
Response.Cookies.Add(cookie)
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
Hi all,
i have to validate for a textbox field in ASP.NET 2.0 using C#.
the requirement is that the textfield should accept only numbers.
i want the field such tat it should accept number..... any number of any length.....
please send me the code for the same......
the regular expression validator with the validation expression
ValidationExpression="[0-9]"
accepts only a single digit number.........
how do i make it accept any number!!!!!!!
Thanks,
Ramesh
|
|
|
|
|
Well, you should change the ValidationExpression to accept more than one character. Also, decide whether you will accept +/- sign before the number, decimal point etc. Than build proper regular expression and that's it.
I strongly recommend to read a little about "creating regular expression" on the MSDN.
And to make it works, and accept any number of digits modify ValidationExpression to "[0-9]*".
--
Mariusz 'mAv' Wójcik
master e-software engineer
|
|
|
|
|
include * in your validation expression either at the begining or at the end.
|
|
|
|
|
hello ramesh,
try to use the following code in Javascript
function CkhInte(obj)
{
if (isNaN(obj.value))
{
alert('Please enter only digits');
return false;
}
}
hope it helps,
please rate this message if useful,
best regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Nice, but when user turn off javascript in browser it will allow him to enter incorrect input. It's necessary to do the same validation on server. ASP.NET validators do both for you.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|