 |
|
|
 |
 |
|
ไม่เข้าใจคำถาม เวลา post อะไร มีตัวอย่าง จะดีมาก เป็นประโยชน์กับคุณเอง เพราะจะได้เข้าใจง่าย
ให้ parameter ใน crystal report เป็น text แล้วก็ส่งค่า value จาก c# เป็น string ไป ไม่ง่ายกว่าหรือครับ จะส่ง ตัวเลข ไปอีกทำไม
วิธีการ pass parameter
Code (C#)
ReportDocument reportDocument;
ParameterFields paramFields;//อันนี้ parameter หลายๆ ตัว
ParameterField paramField;//อันนี้ parameter ตัวเดียว
ParameterDiscreteValue paramDiscreteValue;
reportDocument = new ReportDocument();
paramFields = new ParameterFields();
paramField = new ParameterField();
paramField.Name = "myparamname1";
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = "test1";
paramField.CurrentValues.Add(paramDiscreteValue);
//Add the paramField to paramFields ย้ำนะครับ ว่าเพิ่มเข้าไปแล้ว
paramFields.Add(paramField);
paramField = new ParameterField();
paramField.Name = "myparamname2";
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = "test2";
paramField.CurrentValues.Add(paramDiscreteValue);
//Add the paramField to paramFields ย้ำนะครับ ว่าเพิ่มเข้าไปแล้วรอบที่ 2
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
|
 |
 |
 |
 |
Date :
2010-02-08 16:04:26 |
By :
numenoy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แบบว่าเหมือนออกใบเสร็จคับผม
ยอดรวมทั้งสิ้น 200.00
ยอดเงินเป็นตัวหนังสือ สองร้อยบาทถ้วน
ประมาณนี้อ่ะคับ
ให้มันออกรายงานมา
ขอบคุณคับ
|
 |
 |
 |
 |
Date :
2010-02-08 16:34:04 |
By :
ขอคำตอบอีกทีครับ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สร้าง formula ขึ้นมา 1 อัน ชื่อ BathText แล้วคลิกขวาเลือก edit ใส่โค้ดด้านล่าง
เปลี่ยนแค่ชื่อ ตารางกับชื่อฟิลด์
Code
Local stringVar array D:= ["","สิบ","ร้อย","พัน","หมื่น","แสน"];
Local stringVar array e:= ["หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"];
Local stringVar array Mn;
Local stringVar array Ar1;
Local stringVar Arr;
Local numberVar F;
Local numberVar R;
Local numberVar j;
Local numberVar k;
Local numberVar u;
Local numberVar j2;
Local stringVar Bh;
Local numberVar F2;
Local numberVar j3;
Local numberVar u1;
Local numberVar m3;
Local stringVar Bh3;
//แบ่งจำนวนเต็มและทศนิยมออกจากกัน แล้วเก็บในตัวแปรอาร์เรย์ sm
Ar1:=Split (CStr({ชื่อตาราง.ชื่อฟิลด์},2,""),".");
//นำจำนวนเต็มมาแบ่งตัวเลขออกชุดละหกหลัก ในที่นี้ใช้กับจำนวนหลักสูงสุด 18 หลัก แต่ละชุดที่แบ่งใช้ตัอักษร : คั่น
F:=Len(Ar1[1]);
If F<=6 then Arr:=Ar1[1];
If F>6 and F<=12 then Arr:=Left(Ar1[1],Len(Ar1[1])-6)+":"+Right(Ar1[1],6);
If F>12 and F<=18 then Arr:=Left(Ar1[1],Len(Ar1[1])-12)+":"+Mid(Ar1[1],F-12+1,6)+":"+Right(Ar1[1],6);
//จากนั้นให้มาแยกและเก็บในตัวแปรอาร์เรย์ Mn
Mn:=Split(Arr,":");
//แล้วนำตัวเลขในแต่ละชุดมาสร้างข้อความค่าของเงิน เริ่มจากชุดหลักที่มากที่สุด
For j2:=1 to UBound (Mn) do (
//เริ่มสร้างข้อความค่าของเงินในแต่ละชุดตัวเลข
F2:=Len(Mn[j2]);
//สำหรับตัวเลขสองเป็นยี่ และหลักสิบที่ไม่มีหน่วย
For j:= 1 To F2 do (
If Mid(Mn[j2],j,1)="2" And F2+1-j=8 Then e[2]:="ยี่";
If Mid(Mn[j2],j,1)="1" And F2+1-j=8 Then e[1]:="";
If Mid(Mn[j2],j,1)="2" And F2+1-j=2 Then e[2]:="ยี่";
If Mid(Mn[j2],j,1)="1" And F2+1-j=2 Then e[1]:="";
If Mid(Mn[j2],j,1)="1" And F2+1-j=1 Then e[1]:="เอ็ด";
//สร้างข้อความค่าของเงิน
For R:= 1 To 9 do (
u:= Val(Mid (Mn[j2],j,1));
If u = R Then Bh:= Bh+e[R]+D[F2+1-j];
);
//เปลี่ยนหน่วย ยี่ มาเป็นสอง หลักสิบเป็นหนึ่ง เพื่อใช้ในชุดต่อไป
e[2]:= "สอง";
e[1]:= "หนึ่ง";
);
//สำหรับชุดตัวเลขที่มากกว่าหนึ่งชุด จะต้องเติมคำว่า ล้าน
If j2 <> Ubound(Mn) Then Bh:= Bh+"ล้าน";
Mn[j2]:=Bh;
Bh:="";
);
//มาสร้างข้อความค่าเงิน สำหรับจุดทศนิยม ด้วยวิธีเดียวกันกับจำนวนเต็ม
For j3:=1 To 2 do(
If Mid(Ar1[2],j3,1) ="2" And j3=1 Then e[2]:= "ยี่";
If Mid(Ar1[2],j3,1) ="1" And j3=1 Then e[1]:= "";
If Mid(Ar1[2],j3,1) ="1" And j3=2 Then e[1]:= "เอ็ด";
For m3:=1 To 9 do (
u1:=Val(Mid(Ar1[2],j3,1));
If u1=m3 Then Bh3:=Bh3+e[m3]+D[3-j3];
);
e[2]:="สอง";
e[1]:="หนึ่ง";
);
//รวมข้อความค่าของเงินที่จำนวนเต็มและทศนิยม
If Mn[1]<>"" and Bh3<>"" then
Join (Mn,"")+"บาท"+Bh3+"สตางค์"
Else if Mn[1]<>"" and Bh3="" then
Join (Mn,"")+"บาทถ้วน"
Else If Mn[1]="" and Bh3<>"" then
Bh3+"สตางค์"
Else
""
|
 |
 |
 |
 |
Date :
2010-02-11 16:15:36 |
By :
njnight |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เขียน asp.net ใช้ crystalreport ออกรายงานทำไมวันที่มันไม่เป็นภาษาไทย ตอนเขียน vb.net ยังไช้ได้นะครับ
ปรับที่ web.config ก็ยังไม่ได้ผล มีวิธีไหมครับ
|
 |
 |
 |
 |
Date :
2010-04-05 18:44:08 |
By :
ant |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
NJ NIGHT Thank you so much... Exactly what i needed
|
 |
 |
 |
 |
Date :
2010-05-06 19:59:31 |
By :
POk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
If Mid(Mn[j2],j,1)="1" And F2+1-j=1 Then e[1]:="เอ็ด";
แก้เป็น
If Mid(Mn[j2],j,1)="1" And F2+1-j=1 And j2<>1 And Mid(Mn[j2],j-1,1)<>"0" Then e[1]:="เอ็ด";
//ถ้าตำแหน่งนี้เป็นเลขหนึ่ง และอยู่ตำแหน่งท้ายสุด และไม่ใช่ตัวแรกสุด และตำแหน่งก่อนหน้าไม่ใช่เลข 0
|
 |
 |
 |
 |
Date :
2014-12-15 23:16:13 |
By :
patzy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน crystal report ไม่พบ error แต่นำรายงานไปใส่ใน sap b1 พบว่า ถ้าจำนวนน้อยกว่า 1 มัน Error
|
 |
 |
 |
 |
Date :
2015-09-28 14:37:12 |
By :
bigvote |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2017-02-10 14:15:09 |
By :
puy4088 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|