Jump to content

pintu1228

New Members
  • Posts

    7
  • Joined

  • Last visited

pintu1228's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Can you provide which one is best to use and where I can find some examples to mimic my code? Thanks
  2. Hi, so I have created a frontend page to allow user to select from dropdown list. Depending on dropdown textfields are shown to have them enter values. These 6 PDFs have different pages at the end of each of them (the first 5-6 pages are all the same in them and then the last 7 pages are all different based on which dropdown list is selected). My question is what is the best way to code this: Should I create 6 versions of the php file and call them based on what dropdown list selection is made? Should I keep 1 php file and then check what selection is made (using if statements) and generate PDF? Wouldn't I have lots of repetition if I choose this method since in my code there is lots of formulas. If someone can point me to how to accomplish either of these, that would be great.
  3. In my logs file I get this message: 03-27-2023 13:40:52 type: 8192 msg: __autoload() is deprecated, use spl_autoload_register() instead file: C:\inetpub\wwwroot\include\autoload.inc.php line: 83 context: Array 03-27-2023 13:40:52 Uncaught Exception: Error: Function name must be a string in C:\inetpub\wwwroot\market-shield-plus.inc.php:151 Stack trace: #0 C:\inetpub\wwwroot\make-market-shield-plus\index.php(5): GetHtmlMarketShieldPlus() #1 {main} PHP Notice: Array to string conversion in C:\inetpub\wwwroot\common.php on line 44 autoload.php function __autoload($class) { DOMPDF_autoload($class); common.php function myHandler($type, $msg, $file, $line, $context) { error_log(date("m-d-Y H:i:s") . "\ttype: " . $type . "\t\tmsg: " . $msg . "\t\tfile: " . $file . "\t\tline: " . $line . "\t\tcontext: " . $context . "\r\n", 3, "c:\\illustration\\errors.log"); } What does this mean and how do I fix it?
  4. ok thanks I get them fixed and ask for any questions
  5. $gAnnualWithdrawalsBOY[0] = if($gAgeEOY < $gYearToBeginIncomePayments[0], 0, if($gAgeEOY[0] = $gYearToBeginIncomePayments[0], 0.0*$gBenefitBaseBOY[0], max($gIncomeBenefit[0],0.0*$gBenefitBaseBOY[0]) )); Can you show me how to do this into a valid block statement? Also you mentioned I am using {} instead of () to find value of array, I don't see this in my code. Thanks
  6. For the top screenshot, would i have yo split up the nested if statment? This is how it is presented in my excel sheet. Can php handle excel formulas? I will fix code and update post, Thanks
  7. Hi everyone, I'm new to php and am in need of a little help in figuring out why my variable is not being assigned any value. So I have a global file that has my global variable that main.php uses. global.php: <?php $gYearToBeginIncomePayments = 6; // Base Contract Parameters ( Taken from the 'Client Inputs' Tab/Sheet. ) $gPremiumBonusPercentage = 0.05; $gGmvRate = 0.01; $gCurrentCAP = 0.035; $gCurrentParticipationRate = 0.20; $gMinNonForefeitureRate = 0.01; $gBenefitBasePremiumPercentage = 1.10; $gPremium = 10000; // Arrays $gEndOfYear = []; $gAgeEOY = []; $gPremium = []; $gBonus = []; $gAccountValueBOY = []; $gAnnualWithdrawalsBOY = []; $gInterestCredited = []; $gRiderCharge = []; $gAccountValueEOY = []; $gCashValueEOY = []; $gCreditedInterestPct = []; $gBenefitBaseBOY = []; $gIncomeBenefit = []; $gInterestCredited = []; $gBenefitBaseEOY = []; $gGuaranteedMinimumValue = []; ?> main.php <?php //global variables $gIssueAge = $_POST['txtIssueAge']; $SinglePremium = $_POST['txtSinglePremiumMarket']; $SinglePremium = preg_replace('/[\$,]/', '', $SinglePremium); $gNumberOfRows=$_POST['txtYearsToPrintMarket']; $LastAgeToPrint = $_POST['txtLastAgeToPrintMarket']; //calculations for($i = 0; $i < $gNumberOfRows; $i++) $gAgeEOY [$i] = $i + $gIssueAge; $gPremium[0] = $SinglePremium; for($i = 1; $i < $gNumberOfRows; $i++) $gPremium[$i] = 0; $gBonus[0] = $gPremium[0] * $gPremiumBonusPercentage; $gAccountValueBOY[0] = $gPremium[0] + $gBonus[0]; for($i = 0; $i < $gYearToBeginIncomePayments - 1; $i++) $gAnnualWithdrawalsBOY[$i] = 0; $gBenefitBaseBOY[0] = ($gPremium[0] * $gBenefitBasePremiumPercentage) * $RiderSelected; $gAnnualWithdrawalsBOY[0] = if($gAgeEOY < $gYearToBeginIncomePayments[0], 0, if($gAgeEOY[0] = $gYearToBeginIncomePayments[0], 0.0*$gBenefitBaseBOY[0], max($gIncomeBenefit[0],0.0*$gBenefitBaseBOY[0]) )); for($i = 0; $i < $gNumberOfRows; $i++) { $gAccountValueEOY[$i] = max(0, ( $gAccountValueBOY[$i] - $gAnnualWithdrawalsBOY[$i] + $gInterestCreditedColG{$i} - $gRiderCharge{$i} )); $gAccountValueBOY[$i] = $gAccountValueEOY[$i - 1]; $gInterestCreditedColG[$i] = max(0, (( $gAccountValueBOY[$i] - $gAnnualWithdrawalsBOY[$i] ) * $gCreditedInterestPct[$i]) ); } for($i = 0; $i < $gNumberOfRows; $i++) { $GuaranteedFirstValue = (($gPremium[0] * 0.875) * (1 + $gGmvRate)) - 50; if ($i == 1) { $GuaranteedMinValue = $GuaranteedFirstValue[$i]; } else { $gGuaranteedMinValue = max(0, ($GuaranteedFirstValue - 0) * (1 + $gPremiumBonusPercentage)) - 50; } } ?> Issues: 1. my formulas inside the loop don't show any values, such as the $Premium[0]. 2. when I try to run var_dump, I don't see anything. 3. I am using dompdf to convert html to pdf by the way. 4. all the formulas I am trying to accomplish is from a excel sheet which I am trying to calculate inside php, I don't know if this is even possible. Perhaps this is why I don't get any values for the fields?? Any help would be great. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.