<?php
session_start();
include "connect.php";



		$acsdid = intval($_REQUEST['id']);
		$eve11 = "select * from res_agentcomission_master where acsdid=$acsdid  ";
															$re11 = mysqli_query($conn, $eve11);
															while($rt11 = mysqli_fetch_assoc($re11))
															{
																$countrymid=$rt11['countrymid'];
																$acincentivetype=$rt11['acincentivetype'];
																$actargettype=$rt11['actargettype'];
																$cmgstincexc=$rt11['cmgstincexc'];
																$ctaxname=$rt11['ctaxname'];
																$ctaxpercent=$rt11['ctaxpercent'];
																$actargetvalue=$rt11['actargetvalue'];
																$acmremark=$rt11['acmremark'];
																$commissionstruchervalue=$rt11['commissionstruchervalue'];
																$cmcurrency=$rt11['cmcurrency'];
																$commissionstrucher=$rt11['commissionstrucher'];
																$acstartdate=date("d-m-Y",strtotime($rt11['acstartdate']));
																$acenddate=date("d-m-Y",strtotime($rt11['acenddate']));
																
																		
																			 $eveag1 = "select * from res_country_master where countrymid=$countrymid";
																		$reag1 = mysqli_query($conn, $eveag1);
																		if(mysqli_num_rows($reag1) > 0)
																		{
																			while($rtag1 = mysqli_fetch_assoc($reag1))
																			{
																				$countryname=$rtag1['countryname'];
																			}
																		}
																		else
																		{
																			$countryname="";
																		} 

?>

						<!--begin::Row-->
						<input type="hidden" name="acsdid" value="<?php echo $acsdid; ?>">
																		<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-1 rol-cols-md-1 row-cols-lg-1">
													
																
																<h2><?php echo $countryname; ?></h2>
													<!--end::Col-->
													</div>
												<!--end::Row-->
												
												<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
												<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Start Date</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
													
													<input class="form-control form-control-solid fw-bold pe-5" placeholder="Select date" name="acstartdate" value="<?php echo $acstartdate; ?>" id="kt_daterangepicker_1"/>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													
													<!--begin::Col-->
													<div class="col" >
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">End Date</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															<input class="form-control form-control-solid fw-bold pe-5" placeholder="Select date" name="acenddate"  value="<?php echo $acenddate; ?>" id="kt_daterangepicker_2"/>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
													</div>
												<!--end::Row-->
												<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-3 rol-cols-md-1 row-cols-lg-3">
												<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Incentive Type</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
													
													
													<select class="form-select form-select-solid" data-control="select2"  name="acincentivetype" data-dropdown-parent="#kt_modal_add_user_form11">
													
													<option value="Commission-based system" <?php if($acincentivetype == 'Commission-based system'){ echo 'selected'; }?>>Commission-based system</option>
													<option value="Performance-based system" <?php if($acincentivetype == 'Performance-based system'){ echo 'selected'; }?>>Performance-based system</option>
													<option value="Referral-based system" <?php if($acincentivetype == 'Referral-based system'){ echo 'selected'; }?>>Referral-based system</option>
													<option value="Bonus-based system" <?php if($acincentivetype == 'Bonus-based system'){ echo 'selected'; }?>>Bonus-based system</option>
													<option value="Salary-based system" <?php if($acincentivetype == 'Salary-based system'){ echo 'selected'; }?>>Salary-based system</option>
													
													</select>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													
													<!--begin::Col-->
													<div class="col" >
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Target Type</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
															
													<select class="form-select form-select-solid" data-control="select2"  name="actargettype" data-dropdown-parent="#kt_modal_add_user_form11">
													
													<option value="Revenue" <?php if($actargettype == 'Revenue'){ echo 'selected'; }?>>Revenue Based</option>
													<option value="Lead" <?php if($actargettype == 'Lead'){ echo 'selected'; }?>>Leads Based</option>
													
													
													</select>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													<!--begin::Col-->
													<div class="col" >
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Target Value</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															<input class="form-control form-control-solid fw-bold pe-5"  name="actargetvalue" value="<?php echo $actargetvalue; ?>" text="number"/>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
													</div>
												<!--end::Row-->
												<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
												<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Commission Structure</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
													
													<select class="form-select form-select-solid" data-control="select2"  name="commissionstrucher" id="commissionstrucher23" data-dropdown-parent="#kt_modal_add_user_form11">
													
													<option value="Percentage" <?php if($commissionstrucher == 'Percentage'){ echo 'selected'; }?>>Percentage</option>
													<option value="Fixed Amount" <?php if($commissionstrucher == 'Fixed Amount'){ echo 'selected'; }?>>Fixed Amount</option>
													
													</select>
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													
													<!--begin::Col-->
													<div class="col" id="value23">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Value</span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															<input type="text" class="form-control form-control-solid" name="commissionstruchervalue" value="<?php echo $commissionstruchervalue; ?>" >
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
													</div>
												<!--end::Row-->
												<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
													
													<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="">Tax</span>
															</label>
															<!--end::Label-->
																
																<select class="form-select form-select-solid" data-control="select2"   name="ctaxname" data-dropdown-parent="#kt_modal_add_user_form11">
													<option value="GST" <?php if($ctaxname == 'GST'){ echo 'selected'; }?>>GST</option>
																	<option value="HST" <?php if($ctaxname == 'HST'){ echo 'selected'; }?>>HST</option>
																	<option value="PST" <?php if($ctaxname == 'PST'){ echo 'selected'; }?>>PST</option>
																	<option value="QST" <?php if($ctaxname == 'QST'){ echo 'selected'; }?>>QST</option>
																	</select>
																</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																Tax Percentage
															</label>
															<!--end::Label-->
															<input type="number" class="form-control form-control-solid" name="ctaxpercent" value="<?php echo $ctaxpercent; ?>" >
															
															</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
												</div>
												
												<!--end::Row-->
												<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
													<!--begin::Col-->
													<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="">Tax Included/Excluded</span>
															</label>
															<!--end::Label-->
																
																<select class="form-select form-select-solid" data-control="select2"   name="cmgstincexc" data-dropdown-parent="#kt_modal_add_user_form11">
													<option value="Included" <?php if($cmgstincexc == 'Included'){ echo 'selected'; }?>>Included</option>
																	<option value="Excluded" <?php if($cmgstincexc == 'Excluded'){ echo 'selected'; }?>>Excluded</option>
																	<option value="Not Applicable" <?php if($cmgstincexc == 'Not Applicable'){ echo 'selected'; }?>>Not Applicable</option>
																	
																	</select>
																</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
												<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="">Currency </span>
															</label>
															<!--end::Label-->
															<select class="form-select form-select-solid" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form11"  name="cmcurrency">
													<?php 
																			$eve1 = "select * from res_country_master ";

																			$re1 = mysqli_query($conn, $eve1);
																			
																			while($rt1 = mysqli_fetch_assoc($re1))

																			{											
																				
																				
																				$countrycurrency=$rt1['countrycurrency'];
																				if($cmcurrency == $countrycurrency)
																				{
																				echo "<option value='$countrycurrency' selected>$countrycurrency</option>";
																				}else{
																					echo "<option value='$countrycurrency'>$countrycurrency</option>";
																				}
																				 
																			}
																			
																	?>
													</select></div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
												</div>
												
												<!--end::Row-->
												<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																Remarks
															</label>
															<!--end::Label-->
															<textarea type="number" class="form-control form-control-solid" name="acmremark" value="" ><?php echo $acmremark; ?></textarea>
															
															</div>
														<!--end::Input group-->
													
															<?php } ?>