Ejemplo n.º 1
0
        <div class="editinstructions">
			<?php 
echo Yii::t('admin', 'These orders are ready to be downloaded into Lightspeed. Editing provided for troubleshooting purposes only. Please use caution when using these options, and consult our online documentation and technical support resources for assistance. <strong>Note: missing tax codes will prevent an order from downloading.</strong>');
?>
        </div>
    </div>
    <div class="clearfix search">
        <div class="pull-right">
			<?php 
echo CHtml::beginForm($this->createUrl('databaseadmin/pending'), 'get');
?>
			<?php 
echo CHtml::textField('q', Yii::app()->getRequest()->getQuery('q'), array('id' => 'xlsSearch', 'placeholder' => 'SEARCH...', 'submit' => ''));
?>
			<?php 
echo CHtml::endForm();
?>
        </div>
    </div>

	<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'user-grid', 'itemsCssClass' => 'table-bordered', 'dataProvider' => $model->searchAdmin(), 'summaryText' => '', 'columns' => array(array('name' => 'id_str', 'header' => 'Web Order #', 'type' => 'raw', 'value' => '"<a href=\\"#\\" id=\\"".$data->id."\\" class=\\"basic\\">".$data->id_str."</a>"', 'headerHtmlOptions' => array('class' => 'span2')), array('name' => 'customer.fullname', 'header' => 'Customer', 'headerHtmlOptions' => array('class' => 'span4')), array('header' => 'Items', 'sortable' => false, 'name' => 'item_count', 'headerHtmlOptions' => array('class' => 'span1')), array('name' => 'shipping.shipping_sell', 'header' => 'Shipping', 'sortable' => false, 'headerHtmlOptions' => array('class' => 'span2'), 'value' => '_xls_currency($data->shipping_sell)'), array('class' => 'editable.EditableColumn', 'name' => 'tax_code_id', 'headerHtmlOptions' => array('class' => 'span2'), 'sortable' => false, 'editable' => array('type' => 'select', 'url' => $this->createUrl('databaseadmin/update'), 'source' => CHtml::listData(TaxCode::model()->findAll(), 'lsid', 'code'), 'options' => array('onblur' => 'submit', 'showbuttons' => false, 'emptytext' => 'MISSING!'))), array('name' => 'total', 'sortable' => false, 'headerHtmlOptions' => array('style' => 'span1'), 'value' => '_xls_currency($data->total)'))));
?>


</div>




Ejemplo n.º 2
0
 /**
  * Removes the tax from a tax inclusive price. Since our TaxIn prices are generated from our
  * default tax code, we can use this to undo the tax
  * @param $fltPrice
  * @return float
  */
 public static function StripTaxesFromPrice($fltSellTotal, $intTaxStatusId)
 {
     static $objTaxes;
     // Cached for better performance
     $fltSellTotalTaxed = $fltSellTotal;
     $arrTaxAmount = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);
     $intTaxCodeId = 0;
     $objTaxCodes = TaxCode::model()->findAll(array('order' => 'list_order'));
     //Default tax code is first in list
     $objTaxCode = $objTaxCodes[0];
     if (!$objTaxCode) {
         if (!is_null($intTaxCodeId)) {
             //Ignore null at this stage
             Yii::log("Unknown tax code passed: {$intTaxCodeId}", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         }
         return array($fltSellTotalTaxed, $arrTaxAmount);
     }
     if ($intTaxStatusId instanceof TaxStatus) {
         $objTaxStatus = $intTaxStatusId;
     } elseif ($intTaxStatusId >= 0) {
         $objTaxStatus = TaxStatus::model()->findByAttributes(array('lsid' => $intTaxStatusId));
     } else {
         $objTaxStatus = false;
     }
     if (!$objTaxes) {
         $objTaxes = Tax::model()->findAll();
     }
     $taxtypes = 5;
     // Number of taxes in LS
     // for each exempt, reset the code to 0
     if ($objTaxStatus) {
         if ($objTaxStatus->tax1_status) {
             $objTaxCode->tax1_rate = 0;
         }
         if ($objTaxStatus->tax2_status) {
             $objTaxCode->tax2_rate = 0;
         }
         if ($objTaxStatus->tax3_status) {
             $objTaxCode->tax3_rate = 0;
         }
         if ($objTaxStatus->tax4_status) {
             $objTaxCode->tax4_rate = 0;
         }
         if ($objTaxStatus->tax5_status) {
             $objTaxCode->tax5_rate = 0;
         }
     }
     $i = 0;
     foreach ($objTaxes as $objTax) {
         $strRate = "tax" . ($i + 1) . "_rate";
         if ($objTaxCode->{$strRate} > 0) {
             if ($objTax->compounded) {
                 $fltTaxAmount = $fltSellTotalTaxed / ($objTaxCode->{$strRate} / 100);
             } else {
                 $fltOrig = $fltSellTotal / (1 + $objTaxCode->{$strRate} / 100);
                 $fltTaxAmount = round($fltSellTotal - $fltOrig, 2);
             }
         } else {
             $fltTaxAmount = 0;
         }
         if ($objTax->max_tax > 0 && $fltTaxAmount >= $objTax->max_tax) {
             $fltTaxAmount = $objTax->max_tax;
         }
         $arrTaxAmount[$i + 1] = $fltTaxAmount;
         $fltSellTotalTaxed = $fltSellTotalTaxed - $fltTaxAmount;
         $i++;
         if ($i >= $taxtypes) {
             $i = $taxtypes;
         }
     }
     return $fltSellTotalTaxed;
 }
Ejemplo n.º 3
0
	    <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'user-grid', 'itemsCssClass' => 'table-bordered', 'dataProvider' => $model->search(), 'summaryText' => '', 'columns' => array(array('class' => 'editable.EditableColumn', 'sortable' => false, 'id' => 'country', 'name' => 'country', 'headerHtmlOptions' => array('id' => '$data->id', 'style' => 'width: 110px'), 'editable' => array('type' => 'select', 'url' => $this->createUrl('shipping/updateDestination'), 'placement' => 'right', 'source' => Country::getCountriesForTaxes(), 'options' => array('onblur' => 'submit', 'showbuttons' => false, 'success' => 'js:function(response, newValue) {
									if(response=="delete")
										window.location.reload();
									else {
										var pk = $(this).data("pk");
										var country = newValue;
										var state = $("a[rel=user-grid_Destination_state][data-pk="+pk+"]");
										var newurl = "' . $this->createUrl('shipping/destinationstates') . '?a=1&country_id=" + country;
										$.get(newurl,function(jsdata) {
											response = $.parseJSON(jsdata);
											state.editable("option", "source", jsdata);
											state.editable("setValue", null);
											 });
									}
								}', 'emptytext' => 'Any'))), array('class' => 'editable.EditableColumn', 'name' => 'state', 'headerHtmlOptions' => array('style' => 'width: 110px'), 'sortable' => false, 'editable' => array('url' => $this->createUrl('shipping/updateDestination'), 'type' => 'select', 'source' => $this->createUrl('shipping/destinationstates') . '?a=1&country_id=0', 'placement' => 'right', 'onInit' => 'js: function(e, params) {
							if ($(this).data("value")>=0) {
								var pk = $(this).data("pk");
								var country = $("a[rel=user-grid_Destination_country][data-pk="+pk+"]").editable("getValue").country;
								var newurl = "' . $this->createUrl('shipping/destinationstates') . '?a=1&country_id=" + country;
								$(this).editable("option", "source", newurl);
							}}', 'options' => array('onblur' => 'submit', 'showbuttons' => false, 'emptytext' => 'Please Choose'))), array('class' => 'editable.EditableColumn', 'sortable' => false, 'name' => 'zipcode1', 'headerHtmlOptions' => array('style' => 'width: 110px'), 'editable' => array('url' => $this->createUrl('shipping/updateDestination'), 'options' => array('onblur' => 'submit'))), array('class' => 'editable.EditableColumn', 'sortable' => false, 'name' => 'zipcode2', 'headerHtmlOptions' => array('style' => 'width: 110px'), 'editable' => array('url' => $this->createUrl('shipping/updateDestination'), 'options' => array('onblur' => 'submit'))), array('class' => 'editable.EditableColumn', 'sortable' => false, 'name' => 'taxcode', 'headerHtmlOptions' => array('style' => 'width: 110px'), 'editable' => array('url' => $this->createUrl('shipping/updateDestination'), 'type' => 'select', 'source' => CHtml::listData(TaxCode::model()->findAll(), 'lsid', 'code'), 'options' => array('onblur' => 'submit', 'showbuttons' => false, 'emptytext' => 'MISSING!'))))));
?>


</div>




Ejemplo n.º 4
0
 public static function LoadByLS($intId)
 {
     return TaxCode::model()->findByAttributes(array('lsid' => $intId));
 }
Ejemplo n.º 5
0
 /**
  * Tax Code List
  *
  * @param string $passkey
  * @return string
  * @throws SoapFault
  * @soap
  */
 public function list_tax_codes($passkey)
 {
     self::check_passkey($passkey);
     $obj = TaxCode::model()->findAll();
     return CJSON::encode($obj);
 }
Ejemplo n.º 6
0
		<?php 
echo $form->textField($model, 'zipcode2');
?>
		<?php 
echo $form->error($model, 'zipcode2');
?>
    </div>
</div>

<div class="row">
    <div class="span5">
		<?php 
echo $form->labelEx($model, 'taxcode');
?>
		<?php 
echo $form->dropDownList($model, 'taxcode', CHtml::listData(TaxCode::model()->findAll(array('order' => 'list_order')), 'lsid', 'code'));
?>
		<?php 
echo $form->error($model, 'taxcode');
?>
    </div>
</div>

<div class="row">
    <div class="pull-right" >
	    <?php 
echo CHtml::ajaxSubmitButton(Yii::t('global', 'Save'), array('shipping/newdestination'), array('type' => "POST", 'success' => 'js:function(data) {
	                if (data=="success")
	                window.location.reload();
	                else alert(data);
                 }'), array('id' => 'btnSubmit', 'class' => 'btn btn-primary btn-small'));