怎么添加商品和服务的税收分类编码

怎么添加商品和服务的税收分类编码,第1张

1、进入开票软件主界面,点击系统设置。

2、页面跳转,点击商品编码。

3、进入商品编码界面,点击增加。

4、页面d出商品编码添加对话框,点击税收分类编码。

5、进入分类编码主界面,点击页面左边的分类,选择相符的税收编码,找不到的话可以检索。

6、商品税收编码选择好后,点击保存。

7、页面d出增加成功提示,点击确认即可添加商品和服务的税收分类编码。

如何在网站编辑器中为商品添加分类?

打开简易商店管理点击【设置】→【商品分类】,点击【添加商品分类】按钮开始为商品设置种类。

设置好商品分类后回到商品列表为每个商品添加不同的商品分类。

点击一个商品进入商品编辑面板,在【商品分类】版块,从下拉列表框为该商品选择不同的商品分类,每个商品最多可以有5个商品分类标签。

最后,点击商品编辑器右下角的【保存】按钮保存商品信息,然后按照同样的方法为其他商品添加分类。

在网站编辑器里,可以通过点击简易商店版块右上角的商品分类下拉列表为每个商店版块选择不同的商品分类视图(【布局】按钮左边)。

ecshop的商品分类页面category.php 下的分类,默认是取得所有同级父分类以及父类别的子分类。比如,我点击进入是A商品分类的页面 category.php?id=1,事实上 我只需要取得父ID为1的子分类即可,但是ecshop也把B商品分类、C商品分类.....下的所有子分类也输出来了。这是没必要的。在ecshop下的category.php 334行 $smarty->assign('categories', get_categories_tree($cat_id))//本身也是要起到这个作用,但是虽然有参数$cat_id,但是当$cat_id为顶级分类时候,该参数是无效的。为什么呢?我们来看一下 get_categories_tree( )这个函数(该函数在目录includes/lib_goods.php下)。如下:

/**

* 获得指定分类同级的所有分类以及该分类下的子分类

*

* @access public

* @param integer $cat_id 分类编号

* @return array

*/

function get_categories_tree($cat_id = 0)

{

if ($cat_id >0)

{

$sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'"

$parent_id = $GLOBALS['db']->getOne($sql)

}

else

{

$parent_id = 0

}

/*

判断当前分类中全是是否是底级分类,

如果是取出底级分类上级分类,

如果不是取当前分类及其下的子分类

*/

$sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('category') . " WHERE parent_id = '$parent_id' AND is_show = 1 "

if ($GLOBALS['db']->getOne($sql) || $parent_id == 0)

{

/* 获取当前分类及其子分类 */

$sql = 'SELECT cat_id,cat_name ,parent_id,is_show ' .

'FROM ' . $GLOBALS['ecs']->table('category') .

"WHERE parent_id = '$parent_id' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC"

$res = $GLOBALS['db']->getAll($sql)

foreach ($res AS $row)

{

if ($row['is_show'])

{

$cat_arr[$row['cat_id']]['id'] = $row['cat_id']

$cat_arr[$row['cat_id']]['name'] = $row['cat_name']

$cat_arr[$row['cat_id']]['url'] = build_uri('category', array('cid' =>$row['cat_id']), $row['cat_name'])

if (isset($row['cat_id']) != NULL)

{

$cat_arr[$row['cat_id']]['cat_id'] = get_child_tree($row['cat_id'])

}

}

}

}

if(isset($cat_arr))

{

return $cat_arr

}

}

问题就在这一句

if ($cat_id >0)

{

$sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'"

$parent_id = $GLOBALS['db']->getOne($sql)

}

else

{

$parent_id = 0

}

这一句是判断参数$cat_id是否有父类,若是有父类,就取出其父类的ID,否则视为参数为父类别ID为0,也即为顶级分类。事实上,当参数$cat_id大于0,并且为顶级分类的时候,这句话是无效的,我们假设$cat_id=1,且ID1为顶级ID,也即其parent_id 为0,这种情况下

$sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'"

$parent_id = $GLOBALS['db']->getOne($sql)

运行得出的值还是0,也即$parent_id =0.虽然有参数,但还是取出所有顶级ID下的所有分类。实际上只需要这样修改即可,把

if ($cat_id >0)

{

$sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'"

$parent_id = $GLOBALS['db']->getOne($sql)

}

else

{

$parent_id = 0

}

修改为

if ($cat_id >0)

{

$sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'"

$parent_id = $GLOBALS['db']->getOne($sql)

if($parent_id==0)$parent_id=$cat_id//添加上这句是关键。

}

else

{

$parent_id = 0

}

这时候 参数$cat_id是有效的!


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/7974210.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-12
下一篇2023-04-12

发表评论

登录后才能评论

评论列表(0条)

    保存