#!C:/strawberry/perl/bin/perl.exe use Date::Jalali; use DBI; use Encode; use Wx; our @timeData = localtime(time); our $jalalidate = new Date::Jalali(($timeData[5]+1900),($timeData[4]+1 +),($timeData[3])); our $year = $jalalidate -> jal_year; our $month = $jalalidate -> jal_month; our $day = $jalalidate -> jal_day; our $taxi = decode("utf-8",'تاکسی ت +;لفنی'); our $phone = decode("utf-8",'تلفن'); our $withadmin = decode( "utf-8",'با مدی +ریت'); package MyFrame; use base 'Wx::Frame'; use Wx::Event qw(EVT_BUTTON); use Wx qw(wxDECORATIVE wxNORMAL wxBOLD); #use Wx qw(wxALIGN_RIGHT); #use Wx qw(wxDefaultPosition); use Wx qw(wxWHITE); use Encode; use Win32::Printer; our $title = decode("utf-8",'تماس جž +3;ید'); our $print = decode("utf-8",'چاپ'); our $exit = decode("utf-8",'خروج'); our $codeshterak = decode("utf-8",'کد اشت +;راک'); our $nameuser = decode("utf-8",'نام مش&# +1578;رک/شرکت '); our $address = decode("utf-8",'آدرس'); our $information = decode("utf-8",'توضیح +ات'); our $callednumber = decode("utf-8",'شماره +; تلفن'); our $calltime = decode("utf-8",'ساعت ت&# +1605;اس'); our $calldate = decode("utf-8",'تاریخ'); our $time = decode("utf8",'ساعت تم +;اس'); our $numcash = decode("utf-8",'شماره  +602;بض '); our $customerid = decode("utf8",'کد اشت& +#1585;اک'); our $others = decode("utf-8",'توضیح +5;ت'); our $id = 0; #------------------------------------- $cn = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enabl +e_utf8 => 1}); $dbh = $cn->prepare("select * from telephonetaxiinformation"); $dbh->execute(); my $ref; while($ref = $dbh->fetchrow_arrayref) { our $azansname = @{$ref}->[1]; our $admin = @{$ref}->[2]; our $phone1 = @{$ref}->[3]; our $phone2 = @{$ref}->[4]; our $azansaddress = @{$ref}->[5]; } $cn->disconnect; $dbh->finish; #-------------------------------------- our @array = ('09370938962'); $cn1 = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enab +le_utf8 => 1}); $dbh1 = $cn1->prepare("select * from usersinformation where (phone1='$array[0]' or phone2='$array[0]' or mobil +e1='$array[0]' or mobile2 = '$array[0]')"); $dbh1->execute(); $userphone = $array[0]; my $ref; while($ref = $dbh1->fetchrow_arrayref){ # print "$myname"; our $id = @{$ref}->[0]; our $myname = "@{$ref}->[1] "." @{$ref}->[2]"; our $myaddress = @{$ref}->[7]; $userothers = @{$ref}->[8]; } $dbh1->finish; $cn1->disconnect; #--------------------------------------------- sub new { my $ref = shift; my $self = $ref->SUPER::new( undef, -1, "$title", [-1, -1], [622,320], ); my $panel = Wx::Panel->new( $self, -1, ); my $btnprint = Wx::Button->new( $panel, -1, "$print", [330, 245], [-1, -1], ); my $btnexit = Wx::Button->new( $panel, -1, "$exit", [220, 245], [-1, -1], ); EVT_BUTTON( $self, $btnprint, \&OnClick ); EVT_BUTTON($self,$btnprint,\&print_form); my $maininfo = Wx::SashWindow->new( $panel, -1, [15, 60], [582,170], ); my $style = Wx::TextAttr->new(); $style->Wx::TextAttr::SetAlignment(wxTEXT_ALIGNMENT_CENTER); my $label = Wx::StaticText->new( $panel, -1, "$title", [240,10], [20,10], $style, ); #$label->SetBackgroundColour( wxWHITE ); #$style->Wx::TextAttr::SetTextColour(wxBLUE); #$style->Wx::TextAttr::SetBackgroundColour(wxGREEN); my $timelabel = Wx::StaticText->new( $maininfo, -1, "$timeData[2]:$timeData[1]:$timeData[0] : $cal +ltime", [20,15], [50,40], $style, ); $timelabel->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, + 0)); my $datelabel = Wx::StaticText->new( $maininfo, -1, "$year/$month/$day : $calldate", [20,45], [50,40], $style, ); $datelabel->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, + 0)); my $label1 = Wx::StaticText->new( $maininfo, -1, ": $codeshterak", [490,15], [50,40], $style, ); Wx::StaticText->new( $maininfo, -1, "$id", [400,15], [50,40], $style, ); my $label2 = Wx::StaticText->new( $maininfo, -1, ": $nameuser", [437,45], [100,40], $style, ); Wx::StaticText->new( $maininfo, -1, "$myname", [300,45], [100,20], $style, ); my $label3 = Wx::StaticText->new( $maininfo, -1, ": $address", [519,75], [100,40], $style, );#$information Wx::StaticText->new( $maininfo, -1, "$myaddress", [250,75], [100,25], $style, ); my $label4 = Wx::StaticText->new( $maininfo, -1, ": $information", [500,105], [100,40], $style, ); my $label5 = Wx::StaticText->new( $maininfo, -1, ": $callednumber", [485,135], [100,40], $style, ); Wx::StaticText->new( $maininfo, -1, "$userphone", [350,135], [100,20], $style, ); $label->SetFont(Wx::Font->new(18,wxBOLD,wxDECORATIVE,wxNORMAL, 0)) +; $label1->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, 0) +); $label2->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, 0) +); $label3->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, 0) +); $label4->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, 0) +); $label5->SetFont(Wx::Font->new(10,wxNORMAL,wxDECORATIVE,wxBOLD, 0) +); return $self; } sub OnClick { my( $self, $event ) = @_; $self->SetTitle( 'Clicked' ); } sub print_form{ my $dc = new Win32::Printer( papersize => A4, dialog => NOSELECTION, description => 'taxi', unit => 'mm', orientation => 1 ); my $font = $dc->Font('Titr',24); $dc->Font($font); $dc->Color(0,0,0); $dc->Write("$taxi",190,9,RTLREADING | UTF8 ); $dc->Write("$azansname",151,9,RTLREADING | UTF8 ); my $font1 = $dc->Font('Homa',16); $dc->Write("$phone :",61,14,RTLREADING | UTF8 ); $dc->Write("$phone1",45,10,RTLREADING | UTF8 ); $dc->Write("$phone2",45,18,RTLREADING | UTF8 ); $dc->Write("$address :",190,27,RTLREADING | UTF8 ); $dc->Write("$azansaddress",170,27,RTLREADING | UTF8 ); my $font2 = $dc->Font('Homa',16); $dc->Brush(); $dc->Rect(10,38, 187,60,5,5); $dc->Write("$calldate :",64,39,RTLREADING | UTF8 ); $dc->Write("$year/$month/$day",45,39,RTLREADING | UTF8 ); $dc->Write("$time :",70,47,RTLREADING | UTF8 ); $dc->Write("$timeData[2]:$timeData[1]:$timeData[0]",36,47,RTLREADING | + UTF8 ); $dc->Write("$numcash :",190,39,RTLREADING | UTF8 ); $dc->Write("$customerid :",190,47,RTLREADING | UTF8 ); $dc->Write("$id",160,47,RTLREADING | UTF8 ); $dc->Write("$nameuser :",190,55,RTLREADING | UTF8 ); $dc->Write("$myname",148,55,RTLREADING | UTF8 ); $dc->Write("$address :",190,64,RTLREADING | UTF8 ); my $font3 = $dc->Font('Homa',13); $dc->Write("$myaddress",155,64,RTLREADING | UTF8 ); my $font4 = $dc->Font('Homa',16); $dc->Write("$others :",190,73,RTLREADING | UTF8 ); $dc->Write("$userothers",160,73,RTLREADING | UTF8 ); $dc->Write("$phone :",190,82,RTLREADING | UTF8 ); $dc->Write("$userphone",160,82,RTLREADING | UTF8 ); #$dc->Chord(25, 93, 155, 0.01, 0, 0); $dc->Write("$withadmin :",95,101,RTLREADING | UTF8 ); $dc->Write("$admin",65,101,RTLREADING | UTF8 ); my $font5 = $dc->Font('Homa',8); $dc->Write("نرم افزار +مدیریت آژا  +6;س",41,98,RTLREADING | UTF8); $dc->Close(); } package MyApp; use base 'Wx::App'; sub OnInit { my $frame = MyFrame->new; $frame->Show( 1 ); } package main; my $app = MyApp->new; $app->MainLoop;
In reply to problem in convert Wxperl to .exe program by mohsenali
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |