|
منتدى البرمجة كل ما يتعلق بلغات البرمجة، فيجوال بيسيك , سي ++ , دلفي , أكسيس , جافا , هتمل... |
في حال وجود أي مواضيع أو ردود مُخالفة من قبل الأعضاء، يُرجى الإبلاغ عنها فورًا باستخدام أيقونة ( تقرير عن مشاركة سيئة )، و الموجودة أسفل كل مشاركة .
آخر المواضيع |
|
|
أدوات الموضوع | انواع عرض الموضوع |
2017-06-24, 19:45 | رقم المشاركة : 1 | ||||
|
برنامج حساب الغاز والكهربة
بسم الله الرحمن الرحيم كود:
unit untElecGaz; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons; type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Dlk: TLabel; btnCalc: TBitBtn; Edit2: TEdit; BitBtn2: TBitBtn; Edit3: TEdit; ed2: TEdit; ed3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; Edit8: TEdit; Edit9: TEdit; Edit10: TEdit; Edit11: TEdit; Edit12: TEdit; Edit13: TEdit; Edit14: TEdit; Edit15: TEdit; Memo1: TMemo; Memo2: TMemo; Edit16: TEdit; Edit17: TEdit; Edit18: TEdit; Edit19: TEdit; GroupBox1: TGroupBox; Label18: TLabel; Label19: TLabel; d1: TEdit; d2: TEdit; d5: TEdit; d6: TEdit; GroupBox2: TGroupBox; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label23: TLabel; d3: TEdit; d4: TEdit; ed1: TEdit; ed4: TEdit; d8: TEdit; d7: TEdit; edtJour: TEdit; Edit1: TEdit; Edit20: TEdit; chkbxChoise: TCheckBox; EffacerClick: TBitBtn; procedure btnCalcClick(Sender: TObject); procedure d1Change(Sender: TObject); procedure d1KeyPress(Sender: TObject; var Key: Char); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure chkbxChoiseClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure EffacerClickClick(Sender: TObject); private public end; type TPReel = ^Real; var Form1: TForm1; implementation {$R *.dfm} uses untCalcGazElec, untCalcGazElecs; procedure Effacer; begin Form1.d1.Text := ''; Form1.d2.Text := ''; Form1.d5.Text := ''; Form1.d6.Text := ''; Form1.d1.SetFocus; end; procedure TForm1.btnCalcClick(Sender: TObject); type PTFonctionGazElec = ^TFonctionGazElec; TFonctionGazElec = function: TCusGaElClass; PTGazElecs = ^TGazElec; PTGazElecClassic = ^TGazElecClassic; PTGaEl = ^TGaEl; var tc1, tc2, tc3, tc4: TPReel; gc1, gc2, gc3, gc4: TPReel; i: Integer; GazElecs: PTGazElecs; GazElecClassic: PTGazElecClassic; fonGE: PTFonctionGazElec; GaEl: PTGaEl; begin d3.Text := SousGazElec(StrToInt(d1.Text),StrToInt(d2.Text)); d7.Text := SousGazElec(StrToInt(d5.Text),StrToInt(d6.Text)); if(StrToInt(d3.Text) > 0)and(StrToInt(d7.Text) > 0)then begin ed1.Text := FormatFloat('0.00',MulGazElecCoef(StrToFloat(d3.Text),StrToFloat(d4.Text))); ed4.Text := FormatFloat('0.00',MulGazElecCoef(StrToFloat(d7.Text),StrToFloat(d8.Text))); new(tc1); new(tc2); new(tc3); new(tc4); new(gc1); new(gc2); new(gc3); new(gc4); if chkbxChoise.Checked then begin new(GazElecs); GazElecs^ := TGazElec.Create; try with GazElecs^ do begin Elec(StrToFloat(ed1.Text), tc1^, tc2^, tc3^, tc4^); Edit2.Text := FloatToStr(CalcTraElec(tc1^, tc2^)); Edit3.Text := FloatToStr(CalcTraElec(tc3^, tc4^)); Gaz(StrToFloat(ed4.Text), gc1^, gc2^, gc3^, gc4^); ed2.Text := FloatToStr(CalcTraGaz(gc1^,gc2^)); ed3.Text := FloatToStr(CalcTraGaz(gc3^,gc4^)); end; finally GazElecs^.Free; end; dispose(GazElecs); end else begin new(GazElecClassic); GazElecClassic^ := TGazElecClassic.Create; try with GazElecClassic^ do begin Elec(StrToFloat(ed1.Text), tc1^, tc2^, tc3^); Edit2.Text := FormatFloat('0.00',StrToFloat(Edit4.Text)+ CalcTraElec(tc1^, tc2^)+CalcTraElec(tc3^, 0)); Edit3.Text := '0'; Edit4.Text := '0'; Gaz(StrToFloat(ed4.Text), gc1^, gc2^, gc3^); ed2.Text := FormatFloat('0.00',StrToFloat(Edit5.Text)+ CalcTraGaz(gc1^,gc2^)+CalcTraGaz(gc3^,0)); ed3.Text := '0'; Edit5.Text := '0'; end; finally GazElecClassic^.Free; end; dispose(GazElecClassic); end; dispose(tc4); dispose(tc3); dispose(tc2); dispose(tc1); dispose(gc4); dispose(gc3); dispose(gc2); dispose(gc1); new(fonGE); new(GaEl); fonGE^ := FonctionGazElecClass; GaEl^ := fonGE^.Create; try with GaEl^ do begin with Memo1.Lines do begin Clear; //FormatFloat('0'+DecimalSeparator+'00',12);//Delphi7 . or , or //FormatFloat('0'+FormatSettings.DecimalSeparator+'00',12);//Delphi xe . or , or Montant := StrToFloat(Edit2.Text); TAUX := StrToFloat(Edit9.Text); Add(FormatFloat('0.00',TVA1)); Montant := StrToFloat(Edit3.Text); TAUX := StrToFloat(Edit10.Text); Add(FormatFloat('0.00',TVA1)); Montant := StrToFloat(Edit4.Text); TAUX := StrToFloat(Edit11.Text); Add(FormatFloat('0.00',TVA1)); Montant := StrToFloat(ed2.Text); TAUX := StrToFloat(Edit12.Text); Add(FormatFloat('0.00',TVA1)); Montant := StrToFloat(ed3.Text); TAUX := StrToFloat(Edit13.Text); Add(FormatFloat('0.00',TVA1)); Montant := StrToFloat(Edit5.Text); TAUX := StrToFloat(Edit14.Text); Add(FormatFloat('0.00',TVA1)); end; with Memo2.Lines do begin Clear; Montant := StrToFloat(Edit2.Text); TVA := StrToFloat(Memo1.Lines.Strings[0]); Add(FormatFloat('0.00',Totg)); Montant := StrToFloat(Edit3.Text); TVA := StrToFloat(Memo1.Lines.Strings[1]); Add(FormatFloat('0.00',Totg)); Montant := StrToFloat(Edit4.Text); TVA := StrToFloat(Memo1.Lines.Strings[2]); Add(FormatFloat('0.00',Totg)); Montant := StrToFloat(ed2.Text); TVA := StrToFloat(Memo1.Lines.Strings[3]); Add(FormatFloat('0.00',Totg)); Montant := StrToFloat(ed3.Text); TVA := StrToFloat(Memo1.Lines.Strings[4]); Add(FormatFloat('0.00',Totg)); Montant := StrToFloat(Edit5.Text); TVA := StrToFloat(Memo1.Lines.Strings[5]); Add(FormatFloat('0.00',Totg)); Add(Edit6.Text); Add(Edit7.Text); Add(Edit8.Text); end; Edit16.Text := '0'; Edit17.Text := '0'; with Memo1.Lines do for i := 0 to count-1 do Value := Value+StrToFloat(Strings[i]); Edit16.Text := FormatFloat('0.00',Value); with Memo2.Lines do for i := 0 to count-1 do Value := Value+StrToFloat(Strings[i]); Edit17.Text := FormatFloat('0.00',Value); //('0,00',Value) end; finally GaEl^.Free; end; dispose(GaEl); dispose(fonGE); Edit15.Text := FormatFloat('0.00',StrToFloat(Edit2.Text)+StrToFloat(Edit3.Text)+ StrToFloat(Edit4.Text)+StrToFloat(ed2.Text)+StrToFloat(ed3.Text)+StrToFloat(Edit5.Text)+ StrToFloat(Edit6.Text)+StrToFloat(Edit7.Text)+StrToFloat(Edit8.Text)); Edit19.Text := FormatFloat('0.00',StrToFloat(Edit17.Text)+StrToFloat(Edit18.Text)); Label17.Caption := FormatFloat('0.00',StrToFloat(Edit19.Text)/StrToInt(edtJour.Text)); Edit20.Text := FormatFloat('0.00',StrToFloat(Edit17.Text)-StrToFloat(Edit1.Text)); if StrToFloat(edit15.Text)+StrToFloat(edit16.Text)<>StrToFloat(edit17.Text) then ShowMessage('Error'); end else Effacer; btncalc.Enabled := false; end; procedure TForm1.chkbxChoiseClick(Sender: TObject); begin if chkbxChoise.Checked then begin chkbxChoise.Caption := 'Calcule Nouveau'; edit4.Text := '78,66'; edit5.Text := '85,50'; Edit7.Text := '150'; Edit8.Text := '679,19'; Edit10.Text := '0,19'; Edit13.Text := '0,19'; end else begin chkbxChoise.Caption := 'Calcule Ancien'; edit4.Text := '131,10'; edit5.Text := '85,50'; Edit7.Text := '75'; Edit8.Text := '600'; Edit10.Text := '0'; Edit13.Text := '0'; end; end; procedure TForm1.d1Change(Sender: TObject); begin if(d1.Text <> '')and(d2.Text <> '')and(d5.Text <> '')and (d6.Text <> '')then btnCalc.Enabled := true else btnCalc.Enabled := false; end; procedure TForm1.d1KeyPress(Sender: TObject; var Key: Char); begin if not(key in ['0'..'9',#8]) then key := #0; end; procedure TForm1.EffacerClickClick(Sender: TObject); begin Effacer; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin Application.Terminate; end; procedure TForm1.FormCreate(Sender: TObject); begin //--- GroupBox1 -----------------------------------// Form1.GroupBox1.Caption := 'RELEVE DE COMPTEUR'; Form1.Label8.Caption := 'Index Nouveau'; Form1.Label9.Caption := 'Index Ancien'; Form1.d1.Text := ''; // Index Nouveau Elec Form1.d2.Text := ''; // Index Ancien Elec Form1.d5.Text := ''; // Index Nouveau Gaz Form1.d6.Text := ''; // Index Ancien Gaz //--- GroupBox2 -----------------------------------// Form1.GroupBox2.Caption := ''; Form1.Label20.Caption := 'Différance'; Form1.Label21.Caption := 'COEF'; Form1.Label22.Caption := '(kwh/THERMIE)'; Form1.Label23.Caption := 'CONSOMMATION'; // Index Nouveau - Index Ancien = Différance Form1.d3.Text := ''; // Différance Form1.d4.Text := '1'; // COEF Elec Form1.ed1.Text := ''; Form1.d7.Text := ''; // Différance Form1.d8.Text := '9,02'; // COEF Gaz Form1.ed4.Text := ''; // 0.00 or 0,00 Form1.Label1.Caption := 'CONSOMMATION HORS TVA (DA)'; Form1.Label2.Caption := 'T.V.A'; Form1.Label3.Caption := 'ELEC 54 M'; //-------- TAUX% -----------------// { Form1.Edit9.Text := '0,09'; Form1.Edit10.Text := '0,19'; Form1.Edit11.Text := '0,09'; Form1.Edit12.Text := '0,09'; Form1.Edit13.Text := '0,19'; Form1.Edit14.Text := '0,09'; } //-------- TAUX -----------------// Form1.btnCalc.Caption := 'Calc'; Form1.EffacerClick.Caption := 'Effacer'; Form1.BitBtn2.Caption := '&Fermer'; form1.Edit1.Text := '0'; form1.Edit2.Text := ''; form1.Edit3.Text := ''; form1.Edit4.Text := '78,66'; // Primes Fixes Elec form1.Edit5.Text := '85,50'; // Primes Fixes Gaz form1.Edit6.Text := '100'; // DRIOT FIXE form1.Edit7.Text := '150'; // TAXE HABITATION form1.Edit8.Text := '679,19'; // Soutien Etat form1.Edit18.Text := '162'; // Droit de timbre form1.edtJour.Text := '90'; // Le montant de votre consommation moyenne d'énergie par jour : form1.Edit15.Text := ''; form1.Edit16.Text := ''; form1.Edit17.Text := ''; form1.Edit19.Text := ''; form1.Edit20.Text := ''; end; end.
|
||||
2017-06-24, 19:46 | رقم المشاركة : 2 | |||
|
----------------------- كود:
unit untCalcGazElec; interface uses untCalcGazElecs, SysUtils; type TGazElecClassic = class procedure Elec(tc0: real; var tc1, tc2, tc3: real); overload; procedure Gaz(gcs: real; var gc1, gc2, gc3: real); overload; function CalcTraElec(tco, tco1: real): real; virtual; function CalcTraGaz(gco, gco1: real): real; virtual; end; TGazElec = class(TGazElecClassic) procedure Elec(tc0: real; var tc1, tc2, tc3, tc4: real); overload; procedure Gaz(gcs: real; var gc1, gc2, gc3, gc4: real); overload; function CalcTraElec(tco, tco1: real): real; override; function CalcTraGaz(gco, gco1: real): real; override; end; TCusGaEl = class(TGaEl) private fTAUX: Real; fMontant: Real; fTVA: Real; fVale: Real; protected procedure SetGazEle1(const Vale: Real); override; procedure SetGazEle2(const Vale: Real); override; procedure SetGazEle3(const Vale: Real); override; procedure SetGazEle4(const Vale: Real); override; function GetGazEle1: real; override; function GetGazEle2: real; override; function GetGazEle3: real; override; function GetGazEle4: real; override; public function TVA1: real; override; function Totg: Real; override; end; TCusGaElClass = class of TCusGaEl; function FonctionGazElecClass: TCusGaElClass; function SousGazElec(InNouveau, InAncien: Integer): string; function MulGazElecCoef(Difference, COEF: Real): real; implementation function SousGazElec(InNouveau, InAncien: Integer): string; begin Result := IntToStr(InNouveau-InAncien); end; function MulGazElecCoef(Difference, COEF: Real): real; begin Result := Difference*COEF; end; { TGazElec } function TGazElec.CalcTraElec(tco, tco1: real): real; const PremierTranchePrix = 1.7787; DeuxiemeTranchePrix = 4.1789; TroisiemeTranchePrix = 4.8120; QuatriemeTranchePrix = 5.4796; begin if tco+tco1 <= 250 then Result := tco*PremierTranchePrix+tco1*DeuxiemeTranchePrix else Result := tco*TroisiemeTranchePrix+tco1*QuatriemeTranchePrix; end; function TGazElec.CalcTraGaz(gco, gco1: real): real; const PremierTranchePrix = 0.1682; DeuxiemeTranchePrix = 0.3245; TroisiemeTranchePrix = 0.4025; QuatriemeTranchePrix = 0.4599; begin if gco+gco1 <= 2500 then Result := gco*PremierTranchePrix+gco1*DeuxiemeTranchePrix else Result := gco*TroisiemeTranchePrix+gco1*QuatriemeTranchePrix end; procedure TGazElec.Elec(tc0: real; var tc1, tc2, tc3, tc4: real); const tcom1 = 125; tcom3 = 750; procedure test1; begin tc1 := tcom1; tc2 := tc0 - tc1; end; procedure test2; begin tc3 := tc2 - tc1; tc2 := tc1; end; procedure test3; begin tc4 := tc3 - tcom3; tc3 := tcom3; end; begin tc1 := 0; tc2 := 0; tc3 := 0; tc4 := 0; if tc0 > tcom1 then begin test1; if tc2 > tc1 then begin test2; if tc3 > tcom3 then begin test3; end; end; end else tc1 := tc0; end; procedure TGazElec.Gaz(gcs: real; var gc1, gc2, gc3, gc4: real); const gcom1 = 1125; gcom2 = 1375; gcom3 = 5000; begin gc1 := 0; gc2 := 0; gc3 := 0; gc4 := 0; if gcs > gcom1 then begin gc1 := gcom1; gc2 := gcs - gc1; if gc2 > gcom2 then begin gc3 := gc2 - gcom2; gc2 := gcom2; if gc3 > gcom3 then begin gc4 := gc3 - gcom3; gc3 := gcom3; end; end; end else gc1 := gcs; end; { TGazElecClassic } function TGazElecClassic.CalcTraElec(tco, tco1: real): real; const PremierTranchePrix = 1.779; DeuxiemeTranchePrix = 4.179; TroisiemeTranchePrix = 4.8120; begin if tco1 > 0 then Result := tco*PremierTranchePrix+tco1*DeuxiemeTranchePrix else Result := tco*DeuxiemeTranchePrix; end; function TGazElecClassic.CalcTraGaz(gco, gco1: real): real; const PremierTranchePrix = 0.168; DeuxiemeTranchePrix = 0.324; TroisiemeTranchePrix = 0.402; begin if gco1 > 0 then Result := gco*PremierTranchePrix+gco1*DeuxiemeTranchePrix else Result := gco*DeuxiemeTranchePrix; end; procedure TGazElecClassic.Elec(tc0: real; var tc1, tc2, tc3: real); const tcom1 = 125; tcom = 875; begin tc1 := 0; tc2 := 0; tc3 := 0; if tc0 > tcom1 then begin tc1 := tcom1; tc2 := tc0 - tc1; if tc2 > tcom then begin tc3 := tc2-tcom; tc2 := tc1+tcom; end; {} end else tc1 := tc0; end; procedure TGazElecClassic.Gaz(gcs: real; var gc1, gc2, gc3: real); const gcom1 = 1125; gcom2 = 8875; begin gc1 := 0; gc2 := 0; gc3 := 0; if gcs > gcom1 then begin gc1 := gcom1; gc2 := gcs - gc1; if gc2 > gcom2 then begin gc3 := gc2-gcom2; gc2 := gc1+gcom2; end;{} end else gc1 := gcs; end; { TCusGaEl } function TCusGaEl.GetGazEle1: real; begin Result := fTAUX; end; function TCusGaEl.GetGazEle2: real; begin Result := fMontant; end; function TCusGaEl.GetGazEle3: real; begin Result := fTVA; end; function TCusGaEl.GetGazEle4: real; begin Result := fVale; end; procedure TCusGaEl.SetGazEle1(const Vale: Real); begin inherited; fTAUX := Vale; end; procedure TCusGaEl.SetGazEle2(const Vale: Real); begin inherited; if Vale > 0 then fMontant := Vale else fMontant := 0; end; procedure TCusGaEl.SetGazEle3(const Vale: Real); begin inherited; fTVA := Vale; end; procedure TCusGaEl.SetGazEle4(const Vale: Real); begin inherited; fVale := Vale; end; function TCusGaEl.Totg: Real; begin Result := fMontant+fVale; end; function TCusGaEl.TVA1: real; begin Result := fMontant*fTAUX; end; function FonctionGazElecClass: TCusGaElClass; begin Result := TCusGaEl; end; end. |
|||
2017-06-24, 19:46 | رقم المشاركة : 3 | |||
|
---------------------- كود:
unit untCalcGazElecs; interface type TGaEl = class protected procedure SetGazEle1(const Vale: Real); virtual; abstract; procedure SetGazEle2(const Vale: Real); virtual; abstract; procedure SetGazEle3(const Vale: Real); virtual; abstract; procedure SetGazEle4(const Vale: Real); virtual; abstract; function GetGazEle1: real; virtual; abstract; function GetGazEle2: real; virtual; abstract; function GetGazEle3: real; virtual; abstract; function GetGazEle4: real; virtual; abstract; public function TVA1: real; virtual; abstract; function Totg: Real; virtual; abstract; property TAUX: real read GetGazEle1 write SetGazEle1; property Montant: real read GetGazEle2 write SetGazEle2; property TVA: real read GetGazEle3 write SetGazEle3; property Value: real read GetGazEle4 write SetGazEle4; end; implementation end. وعلى الرابط https://www.mediafire.com/file/tf17d1s8b83map1/elec.rar |
|||
2017-06-27, 01:30 | رقم المشاركة : 4 | |||
|
بارك الله فيك أخي |
|||
الكلمات الدلالية (Tags) |
برنامج،الغاز،الكهربة |
|
|
المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى
المنتدى غير مسؤول عن أي إتفاق تجاري بين الأعضاء... فعلى الجميع تحمّل المسؤولية
Powered by vBulletin .Copyright آ© 2018 vBulletin Solutions, Inc